Skip to content

Commit

Permalink
update docs for R1-1
Browse files Browse the repository at this point in the history
  • Loading branch information
jwlodek committed Apr 17, 2019
1 parent 22bf8fb commit 6227869
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 18 deletions.
23 changes: 13 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,33 @@ To add a new CV function there are several files you will need to edit. First, i

Decide which of these sets your new function falls under, and add it to the Input and Output records.

**Note that for the easiest implementation, it is recommended to only add your function to the last position in function set 3.**

Next, in the NDPluginCVHelper.h file, change the N_FUNC_3 value to take into account the new number of functions in the CompVisionFunction3 PV, or replace the value for the set you inputted your function into.
Next, you will need to edit the NDPluginCVHelper.cpp and NDPluginCVHelper.h files. In NDPluginCVHelper.h, find the definition of ADCVFunction_t and add:
Next, in the `NDPluginCVHelper.h` file, change the `N_FUNC_#` value to take into account the new number of functions in the `CompVisionFunction#` PV you add your function to.
Next, you will need to edit the `NDPluginCVHelper.cpp` and `NDPluginCVHelper.h` files. In `NDPluginCVHelper.h`, find the definition of `ADCVFunction_t` and add:
```
// Some basic flag types
typedef enum {
ADCV_NoFunction = 0,
ADCV_EdgeDetectionCanny = 1,
ADCV_GaussianBlur = 1,
ADCV_Threshold = 2,
.
.
.
ADCV_YOURFUNCTION = n,
ADCV_YOURFUNCTION = n, <- Your function should be added in the appropriate location
.
.
.
ADCV_LastFunction = 15,
} ADCVFunction_t;
```
where n is the next integer. If you added your function to any PV other than the last position in function set 3, you will need to find which value it should be assigned. NoFunction represents the first PV value in function set 1, and the rest count in order, going through set 1 -> set 2 -> set 3, disregarding the PVs for no function in set 2 and 3. Once you found the correct number add it to the enum, and fix any numbers that have changed. This will add the function to the list of possible functions handled by ADCompVision. Then, add the lines:
Make sure to add your function type in the appropriate position, this is important for the conversion from PV value to function type. You will need to find which value it should be assigned. `ADCV_NoFunction` represents the first PV value in function set 1, and the rest count in order, going through set 1 -> set 2 -> set 3, disregarding the PVs for no function in set 2 and 3. Once you found the correct number add it to the enum, and fix any numbers that have changed. This will add the function to the list of possible functions handled by ADCompVision. Then, add the lines:

```
ADCVStatus_t YOURFUNCTION(Mat &img, double* inputs, double* outputs);
ADCVStatus_t get_YOURFUNCTION_description(string* inputDesc, string* outputDesc, string* description);
```
in the 'public' portion of the class declaration. You may follow the standard set by the other functions.
Next, in the NDPluginCVHelper.cpp file, add your new function definitions. They should take the following form:
Next, in the `NDPluginCVHelper.cpp` file, add your new function definitions. They should take the following form:

**The Wrapper**
```
Expand Down Expand Up @@ -121,21 +124,21 @@ ADCVStatus_t NDPluginCVHelper::get_YOURFUNCTION_description(string* inputDesc, s
return status
}
```
**NOTE** The commenting standard for these helper functions should be followed strictly, as it will allow for the provided python script to generate a manual for operation easily. Once you add the function and write the comment above it appropriately, you may run the createIOmanual.py script in the scripts/ directory with:
**NOTE** The commenting standard for these helper functions should be followed strictly, as it will allow for the provided python script to generate a manual for operation easily. Once you add the function and write the comment above it appropriately, you may run the `createIOmanual.py` script in the scripts/ directory with:
```
python3 createIOmanual.py
```
This will create a manual (in docs/manual.html) describing the inputs and outputs of each of the functions including your new custom function along with a description of each function as provided in the comments.

Next, you must edit the 'getFunctionDescription' function in NDPluginCVHelper.cpp. Add a case to the switch statement as follows:
Next, you must edit the `getFunctionDescription` function in `NDPluginCVHelper.cpp`. Add a case to the switch statement as follows:
```
case ADCV_YOURFUNCTION:
status = get_YOURFUNCTION_description(inputDesc, outputDesc, description);
break;
```
This will allow NDPluginCV to update descriptions for each input and output in real time when you select your function.

Finally, you need to edit the 'processImage' function in NDPluginCVHelper.cpp. In the switch statement, add a case as follows:
Finally, you need to edit the `processImage` function in `NDPluginCVHelper.cpp`. In the switch statement, add a case as follows:

```
case ADCV_YOURFUNCTION:
Expand Down
6 changes: 4 additions & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ Dependencies: ADCompVision requires opencv core, highgui, image processing, and

<!--RELEASE START-->

## R1-1 (???-March-2019)
## R1-1 (17-April-2019)

* Computer Vision functions implemented:
* Sharpening filter
* Image subtraction
* Image statistics
* Distance between objects

* Additional Feature changes
* File saving temporarily removed due to crashing issues over ssh and additional dependency
Expand All @@ -26,7 +28,7 @@ Dependencies: ADCompVision requires opencv core, highgui, image processing, and
* Bug where certain PV would cause error at IOC startup
* Fixed Image passthrough to work with any bit depth
* Fixed colorspace of color images passed through
* Removed code that caused certain compiler warnings
* Removed code that caused certain compiler warnings - Cleaner compile

## R1-0 (14-January-2019)

Expand Down
8 changes: 4 additions & 4 deletions adcvApp/adcvSrc/NDPluginCVHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -706,11 +706,11 @@ ADCVStatus_t NDPluginCVHelper::user_function(Mat &img, double* inputs, double* o
* Function that computes bounding boxes between the two largest computed contours in the image,
* checks the distance between them and sends an alarm if they are within a distance threshold.
*
* @inCount -> 1
* @inFormat -> [[Distance Threshold (Int)]
* @inCount -> 5
* @inFormat -> [[Distance Threshold (Int), Blur Kernel Size (Int), Threshold (Int), Apply Blur (Toggle), Pixel Size Threshold (Int)]
*
* @outCount -> 1
* @outFormat -> [Is Within Threshold (Binary Int)]
* @outCount -> 2
* @outFormat -> [Is Within Threshold (Binary Int), Distance in Pixels (Int)]
*/
ADCVStatus_t NDPluginCVHelper::distance_between_ctrs(Mat &img, double* inputs, double* outputs){
const char* functionName = "distance_between_ctrs";
Expand Down
6 changes: 4 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ <h4>Release Notes</h4>

<!--RELEASE START-->

<h4>R1-1 (???-March-2019)</h4>
<h4>R1-1 (17-April-2019)</h4>
<ul>
<li>
<p>Computer Vision functions implemented:</p>
<ul>
<li>Sharpening filter</li>
<li>Image subtraction</li>
<li>Image statistics</li>
<li>Distance between objects</li>
</ul>
</li>
<li>
Expand All @@ -62,7 +64,7 @@ <h4>R1-1 (???-March-2019)</h4>
<li>Bug where certain PV would cause error at IOC startup</li>
<li>Fixed Image passthrough to work with any bit depth</li>
<li>Fixed colorspace of color images passed through</li>
<li>Removed code that caused certain compiler warnings</li>
<li>Removed code that caused certain compiler warnings - Cleaner compile</li>
</ul>
</li>
</ul>
Expand Down
16 changes: 16 additions & 0 deletions docs/manual.html
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,18 @@ <h2 id="Wrapper_params">
<th>[Param1 (Int), Param2 (Double) ...]
</th>
</tr>
<tr>
<th>Distancebetweencontours
</th>
<th>5
</th>
<th>[[Distance Threshold (Int), Blur Kernel Size (Int), Threshold (Int), Apply Blur (Toggle), Pixel Size Threshold (Int)]
</th>
<th>2
</th>
<th>[Is Within Threshold (Binary Int), Distance in Pixels (Int)]
</th>
</tr>

</tbody>
</table>
Expand Down Expand Up @@ -242,6 +254,10 @@ <h3>gaussian_blur
simplify creating user defined functions. Simply implement this function and its description function,
and then select 'User Function' in function set 3.

</p><h3>Distancebetweencontours
</h3><p> Function that computes bounding boxes between the two largest computed contours in the image,
checks the distance between them and sends an alarm if they are within a distance threshold.

</p>
</body>
</html>

0 comments on commit 6227869

Please sign in to comment.