the line drawn in the image is base on highest value of contour extracted. i have width and hight value of this line. (dpi = 144)

i want to find the length of vertical line drawn.

just curious, – what should we see in that image ? how did you acquire that ? is it from a microscope or similar ?

i also don’t understand the green lines in your image, if those are meant to be contours, it kinda looks broken … ?

what did you do to calculate those ? how did you get a binary image from the bgr above ?

This is microscopic image, Aim is to find the highest peak and its length from x-axis. This is the original image.

how did you draw the green lines? manually in a photo editing program? or with code?

i did it with coding

details please.

if you did that with coding, then I you should already have the answer to your question.

yes i already have calculated the hight of the highest peak but that’s wrong. i want you to help me with converting pixel into micrometer. currently, i use length = (h / dpi) * 2.54, ‘h’ is the pixel value of this highest peak. ‘dpi’ is dpi value of image.

i searched out and found above formula, but it does not give correct answer.

where did you get that value from?

you know, you can just calculate that factor: put a ruler under the microscope, then count the pixels from one tick to the next, or across several.

or ask your lab mates. they’ll know all of this already and should be able to teach you.

i got dpi value by using Pillow function.

if i use ruler, if scale is in cm, number of pixel in that one tick would be dpi value, right ?

Rest of the formula is correct?

not “dpi” (inch) but dots per… cm or mm.

Pillow doesn’t know. it just assumes some default value.

camera pictures don’t have “dpi” as such. you always need to know the fixed distance of the object from the camera (similar triangles). or put a ruler at that fixed distance and calculate.

in the right bottom corner, there is a line which is 2mm(this can be consider as a ruler), what if i find out pixel value of this line, then i would know that how many pixels are there in in 2mm and then use it for to find the pixel for highest peak.