Closed Dpksrndrn closed 5 years ago
The line
img.SetPixelSize(dip.PixelSize(0.032 * dip.Units("mm")))
defines the size of a pixel, and causes dip.MeasurementTool.Measure
to report all measurements in physical units. As you can see in your measurement results table, sizes and center are given in mm, not in pixels. If you want measurement results in pixels, don't set the pixel size. If the image file contains a pixel size, img
might have one anyway. You can tell by doing
print(img.GetPixelSize())
You can remove any pixel sizes with
img.SetPixelSize(dip.PixelSize())
After this, you should notice that the measurement tool returns measurements in pixels.
Note that you can use the 'Minimum'
and 'Maximum'
features to get the coordinates of the top-left and bottom-right corners of the bounding box. See https://diplib.github.io/diplib-docs/features.html#size_features_Minimum
Thank you Chris, things are looking much better now
Hi, I am trying to detect two lines at different depths from a camera and align them to be parallel with each other at a fixed distance away from each other. I am able to move the lines in the X-Y plane, including fine rotation. I was able to achieve this using OpenCV, by:
I find that the results obtained from using OpenCV is not repeatable and am trying to improve the overall accuracy of the system.
I am trying to redo the entire program using PyDIP, but cannot find a suitable alternative to using the MinmumAreaRectangle to obtain the top edge of the window. This is my code:
I expect 'CartesianBox' to give me the lengths of the required rectangle and 'Center' to be the origin of the required rectangle, but this does not seem to be the case. I instead get the following when I try to draw the same:
This is the input image that I am using:
As a preliminary step I am trying to recognize the features in a picture before moving onto a video. I would appreciate any inputs on using PyDIP to provide a solution for the same.