![]() ![]() If cv2.waitKey(waitTime) & 0xFF = ord('q'): # Wait longer to prevent freeze for videos. Print("(hMin = %d, sMin = %d, vMin = %d), (hMax = %d, sMax = %d, vMax = %d)" % (hMin, sMin, vMin, hMax, sMax, vMax)) If( (phMin != hMin) | (psMin != sMin) | (pvMin != vMin) | (phMax != hMax) | (psMax != sMax) | (pvMax != vMax) ): # Print if there is a change in HSV value ![]() Output = cv2.bitwise_and(img,img, mask= mask) Hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) # Create HSV Image and threshold into a range. # Set minimum and max HSV values to display VMax = cv2.getTrackbarPos('VMax','image') SMax = cv2.getTrackbarPos('SMax','image') HMax = cv2.getTrackbarPos('HMax','image') VMin = cv2.getTrackbarPos('VMin','image') SMin = cv2.getTrackbarPos('SMin','image') HMin = cv2.getTrackbarPos('HMin','image') PhMin = psMin = pvMin = phMax = psMax = pvMax = 0 HMin = sMin = vMin = hMax = sMax = vMax = 0 # Initialize to check if HSV min/max value changes # Set default value for MAX HSV trackbars. If you are familiar enough with Python, here is a quick interactive interface you can use to choose the HSV range for each region of your image I took from here. This works, but it requires to manually go to the generated ROI, see what blobs are inside the black liquid, and copy them manually to an excel or a similar document.ĭo you have any idea how I could improve this process?Ī common approach to segment an image based on color is to use color filtering.Ī typical workflow consists of converting an RGB to a HSV image and isolating hue, saturation and value ranges that segment your images into the color regions you want. For that, what I have been doing is to use the Color Threshold tool again (once for each liquid), and then the Analyze Particle plugin to measure the perimeters of the blobs of liquid inside the black liquid. Now what I have left to measure is all the interfaces of the black liquid with the other two inside.My images in reality are much more complex than the examples above so here is an example of a real image: I just want to measure the “real” perimeter of my particle. However I need to exclude any “false perimeter” that is being generated by the edge of the image - highlighted in yellow in the image. I need to extract the perimeter of the particles shown in white in the image, I have been using Analyze > Analyze particles… and check “perimeter” in the box. Also, since I am not interested in measuring the edges, I was using the script presented in this previous post:Įxclude image edge from perimeter measurement - Fiji Image Analysis For that, I use the macro I shared before, and I set the Analyze Particle to measure the perimeter. First, I measure the external interface of the black liquid with the rest.I want to measure the length of all the interfaces between the black fluid and the other two. Here is where I do not know how to proceed in an automated way. I was encountering some issues with this macro to be able to have the three colors in the same script, but I believe I could get that to work with some more time iterating on it. I created different macros for it by using Plugins - Macros - Record… and they work well. Length of the interfaces of the black liquid with the other two (grey and red).įor the area measurement, I was using the Color Threshold tool and the Analyze Particles plugin and it works great.There are three different tones (grey-ish, black, and red). I am capable of doing the analysis by hand, but I will have to analyze over a hundred pictures, and it is very time-consuming, so I was hoping there was a way I could automate this process. I have been reading this forum for a while, and I cannot find a solution for the problem I encountered. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |