フィルターのクリア

1D projection of image and cross correlation

5 ビュー (過去 30 日間)
Vivek
Vivek 2022 年 11 月 9 日
回答済み: Gokul Nath S J 2023 年 5 月 26 日
I would like to project a image in 1D and take a flipped version of it and take the cross correlation . how can I plot the 1D profille and the flipped image overlayed and the crosscorelation in matlab

回答 (1 件)

Gokul Nath S J
Gokul Nath S J 2023 年 5 月 26 日
Hi Vivek,
To plot the 1D profile and the flipped image overlaid with the cross-correlation plot in MATLAB, you can use the plot function to plot the 1D profile and flipped image, and the xcorr function to compute the cross-correlation. Here's an example code that shows how to do this:
% Load the image to be flipped and cross-correlated
img = imread('sample_image.png');
% Convert the image to grayscale and resize to a 1D vector
img_gray = rgb2gray(img);
img_vector = double(img_gray(:));
% Flip the image vector
img_flipped = flip(img_vector);
% Compute the cross-correlation between the original and flipped images
[r,lags] = xcorr(img_vector, img_flipped);
% Plot the 1D profile and flipped image overlaid
figure;
plot(1:length(img_vector), img_vector, 'b');
hold on;
plot(1:length(img_flipped), img_flipped, 'r');
legend('Original Image', 'Flipped Image');
xlabel('Pixel Position');
ylabel('Intensity');
title('Original and Flipped Images');
% Plot the cross-correlation
figure;
plot(lags, r);
xlabel('Lag');
ylabel('Cross-Correlation Coefficient');
title('Cross-Correlation between Original and Flipped Images');
with regards,
Gokul Nath S J

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by