Effacer les filtres
Effacer les filtres

Use pixel informations to create a grid on images

2 vues (au cours des 30 derniers jours)
Francesco
Francesco le 23 Jan 2012
Hi,
I have an picture of graph paper I have to use as a reference. To be clear I have to use the grid as calibration for an acquisition sistem wich I used also to acquire the picture.
I want to get the grid of this image and superimpose it on other images that are acquired during a measurement session. Is it possible? how to do it? I was thinking to count the pixel between two lines and get the coordinates of the central pixel and make a plot on the other images using this information
Thanks

Réponse acceptée

Image Analyst
Image Analyst le 23 Jan 2012
Sounds reasonable. If the image is good, threshold it and find the crossings
columns = find(grayImage(rowToExamine, :) < 100);
There are more robust ways to do it where you look at more than just one line.
  2 commentaires
Francesco
Francesco le 24 Jan 2012
could you give me some link with examples?
where to find the function 'rowToExamine'?
I have undefined function error.
-Sorry, but I am a really newbie
Image Analyst
Image Analyst le 24 Jan 2012
% Make all white image.
grayImage = 255 * ones(256, 'uint8');
% Put dark grid into it
grayImage(8:16:256, :) = 0; % Make dark rows
grayImage(:, 8:16:256) = 0; % Make dark columns
% Display the original gray scale image.
imshow(grayImage, []);
axis on;
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]); % Maximize figure.
set(gcf,'name','Demo by ImageAnalyst','numbertitle','off')
% Pick some line to examine
rowToExamine = 50;
% Find columns in line 50 that are dark.
columns = find(grayImage(rowToExamine, :) < 100)
msgbox('Demo done. Look in command window for results.');

Connectez-vous pour commenter.

Plus de réponses (2)

Francesco
Francesco le 24 Jan 2012
I managed to get the central pixel coordinates [X0,Y0] (using ginput) and the distance between two points (using imdistline). I have converted the image in a gray scale using im2double and I want to change pixel value in the first quadrant. (image is almost black) I mean I would like to set as white each pixel of every rows between 1 and Y0 with step equal to the distance calculated above and do the same for the column between X0 and 821. How to do that? (the image size is 577X821X3 double and MatLab says that 821 index exceeds matrix dimensions)
  2 commentaires
Image Analyst
Image Analyst le 24 Jan 2012
You're probably mixing up row and column with x and y. Be aware that x = column, and y = row. You need to index image arrays by row and column, not x and y so it's
imageArray(row, column, colorChannel)
which is
imageArray(y, x, colorChannel)
NOT
imageArray(x, y, colorChannel)
Francesco
Francesco le 24 Jan 2012
Yes, you where right, I was mixing row and column.
Anyway using your prevoius example I did it. It is a bit of a crap to see but I have the grid I need.
thank you.

Connectez-vous pour commenter.


Francesco
Francesco le 25 Jan 2012
I managed to improve the graphic aspect, now I was wondering if it is possible to make the grid with rounded shape and a fixed radius of 200 pixels...
  1 commentaire
Image Analyst
Image Analyst le 25 Jan 2012
Please provide a snapshot of the rounded grid with a radius. Post it to tinypic.com. Do you mean like some kind of polar coordinates grid?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Images dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by