Search for the coordinates of each pixel using programming

How can I find the coordinates of each pixel of the inner circle (or outer) in the next image using programming (openCV or MATLAB)?
imtool provides this information, but it is controlled by the mouse.

enter image description here

Refresh

I used imtool to detect these locations by hovering over each point on the circle and manually noting this value. But how to do this using manual programming, I can’t do it for so many pints in a circle.

+6
source share
3 answers

In Matlab, you can simply:

im = imread('im.png'); %# load image [y,x] = find(all(im<5, 3)); %# find black pixels position = [x,y]; %# display them 
+5
source

Here is a guide to using openCV to search for an object with hue and saturation filtering. Perhaps you can use it with a black threshold?

http://myrobotlab.org/content/opencv-how-isolate-object-hue-saturation-and-value

There is also a way to detect circles here:

http://cgi.cse.unsw.edu.au/~cs4411/wiki/index.php?title=OpenCV_Guide

0
source

you can implement this code ...

 a=rgb2gray(imread('image.tif')); [x,y,z]=size(a); count=0; for i=1:x for j=1:y if a(i,j)==0 count=count+1; new_x(count)=j; new_y(count)=i; end end end 

You can get coordinate values ​​from new_x and new_y

-1
source

Source: https://habr.com/ru/post/921367/


All Articles