Project data for each pixel along the edge direction
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a slanted-edge image that I would like to project data for each pixel along the edge direction same way as the picture below.
any idea to do this?
0 comentarios
Respuestas (1)
Johannes Fischer
el 28 de Ag. de 2019
Do you know the angle? You could rotate the image to align the edge with the grid and then project along one dimension:
%% example preparation
% create edge
img = zeros(100,100);
img(:, 50:100) = 1;
theta = 10; % deg
% create slanted edge
imgR = imrotate(img, theta, 'bilinear');
%% solution
% align slanted edge with grid
imgRR = imrotate(imgR, -theta, 'bilinear');
% project image data of both images
projectionR = sum(imgR, 1);
projectionRR = sum(imgRR, 1);
figure
subplot(1, 3, 1)
title('original image')
imagesc(imgR)
subplot(1, 3, 2)
title('rotated image')
imagesc(imgRR)
subplot(1, 3, 3)
hold on
plot(projectionR)
plot(projectionRR)
Bear in mind, that imrotate adds zeros to contain all the infomation in the rotated image. Adding zeros does of course not interfere with the summation, but you need to make sure that the alignment is correct.
1 comentario
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!