This repository contains code related to research methodologies related to quantifying driver blind spots and fields of view for various vehicles.
x64 Windows is currently the only platform support available.
The app is a C++ application that can be built in Visual Studio, but you will need the C++ desktop tools to do so. You can install the Desktop Development with C++ tools (including cmake) from the Tools > Get tools and features menu in Visual Studio.
- Clone this repo to your local system.
- Open the
pgrid.sln
solution file in Visual Studio. - Set the pgrid project as the start up project.
- Sent the environment to Debug and x64.
- Build the solution.
- Start the Local Windows Debugger.
The app relies on a camera profile (.ocp) to be able to correctly calculate the points in annotated images. You should select a camera profile for the specific camera your images were taken with. If you need to create a new camera profile, use the following steps:
- Print out the OpenCV camera calibration pattern (https://github.com/opencv/opencv/blob/4.x/doc/pattern.png) on a sheet of paper at scale. Note the size of the grid (this one should be 9x6).
- Mount the printed pattern on a flat, stationary surface. Make sure the pattern is not warped or distorted.
- Take a series of images of the pattern from different angles and distances, but all using the same zoom and focal length. Make sure the pattern is fully visible in the images.
- Make sure all of the images are saved as .jpg files in one directory with nothing else in it. (Any other image format, including .JPG and .jpeg, will not work.)
- Open the app, and go to Tools > Camera Profile > New Camera Profile.
- Fill out the Camera Details fields, taking care to make sure the zoom level and focal length are accurate.
- Select your image directory for the calibration images.
- Enter the camera calibration checkerboard pattern size, adjusting for pattern orientation if necessary.
- Select a file to save the camera profile to.
- Click Run Calibration. The app will attempt to calibrate the camera using the images in the directory. If calibration is successful, the camera profile will be saved to the selected file.
The app has several available grid alignment methods but we're aiming to use the "marklerless" mode. This mode uses a single camera to capture images of the vehicle and the environment. The user will be prompted to select a region of interest (ROI) in the image. The app will then use the ROI to detect the vehicle and calculate the blind spot and field of view. Other modes are expected to be buggy and are mostly just proof of concept.
To use "markerless" mode:
- Open the app.
- Click "Load camera profile" and select the relevant camera profile for the image(s). Each camera should have it's own specific profile & calibration.
- Use file > Import image to import the image.
- Select the "markerless" mode.
- Input the various camera position values for the image (X, Y, and Z offsets + camera rotation).
- Annotate the visible region in the image using the Paint mode.
- Export the results by selecting a file location, giving the file a name (don't forget the .csv extension!), adding the dummy settings, and clicking Write Output. Use append to add to an existing file.
-
In order to remove the hardcoded "_Test" at the end of published MSIX directory names, Microsoft requires you to edit the
Microsoft.AppxPackage.Targets
file, which for VS 2022 can be found atC:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VisualStudio\v17.0\AppxPackage
.Remove the "_Test" suffix from the AppxPackageTestDir and AppxPackageTestExternalPackagesDir conditions. The edited code should look like this:
<PropertyGroup Condition="'$(AppxPackageTestDir)' == ''"> <AppxPackageTestDir Condition="'$(ProduceAppxBundle)' == 'false'">$(AppxPackageDir)$(AppxPackageName)\</AppxPackageTestDir> <AppxPackageTestDir Condition="'$(ProduceAppxBundle)' == 'true'">$(AppxPackageDir)$(AppxPackageNameNeutral)$(_AppxPackageConfiguration)\</AppxPackageTestDir> </PropertyGroup> <PropertyGroup Condition="'$(AppxPackageTestExternalPackagesDir)' == ''"> <AppxPackageTestExternalPackagesDir Condition="'$(ProduceAppxBundle)' == 'false'">$(AppxPackageDir)$(AppxPackageName)\$(ExternalPackagesDir)</AppxPackageTestExternalPackagesDir> <AppxPackageTestExternalPackagesDir Condition="'$(ProduceAppxBundle)' == 'true'">$(AppxPackageDir)$(AppxPackageNameNeutral)$(_AppxPackageConfiguration)\$(ExternalPackagesDir)</AppxPackageTestExternalPackagesDir> </PropertyGroup>
-
Make sure you build in Release for x64.
-
Right click on the pgridPackagingProject project and select Publish > Create App Packages ...
-
Select sideloading with automatic updates, and click Next.
-
Select a software signing certificate to sign the app package, with http://timestamp.digicert.com timestamp server and SHA256 algorithm. Click Next.
-
Use the following settings, and then click Next:
- Output location: < path to local folder where install files will be copied >
- Auto increment version number
- Generate app bundle: never
- Packages to create: x64 Release
-
Use the following settings, and then click Create:
- Installer location: < url or path to installer location after copy >
- Check for updates: every time the application runs
-
If successful, you will get a pop up with details of the deployment and the installation page should be available at the installer location you specified above (which can be used for both installation and updates).
This software is licensed under the terms of the Apache License, version 2.0.
This software was built with appreciation using the following open source projects, without modification to their original source code: