AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Mahalanobis distance opencv9/16/2023 ![]() ![]() white areas), hence we'll need to invert the image first COLOR_BGR2GRAY ) # findContours will find contours on bright areas (i.e. threshold ( mask, thresh_min, thresh_max, 0 ) # findContours requires a monochrome image. imread ( 'mask.png' ) #The mask variable in your code # plt.imshow(mask) bitwise_and ( frame, frame, mask = mask )Īssuming input frames will have "close to rectangle" shapes (where the following code works best), you have to use the findContours function to get the black region's boundary and boundingRectfunction to get it's dimensions. # ^Get height of the black region in this image # Bitwise-AND mask and original image dilate ( mask, maskMorph ) # ^Now the mask is a black and white image. inRange ( hsv, lower_blue, upper_blue ) # applica filtri morfologici array () # Threshold the HSV image to get only blue colors COLOR_BGR2HSV ) # define range of blue color in HSV This two rectangle together create the square frame. I want to measure the length of the base of the area (because I have a white rectangle and a black rectangle). With a pi camera I record a video and in real time I can recognize blue from other colors (I see blue as white and other colors as black). I'm a newbie with Open CV and computer vision so I humbly ask a question. ![]()
0 Comments
Read More
Leave a Reply. |