seperating vertical and horizontal images from an image seperately

1 visualizzazione (ultimi 30 giorni)
I want to seperate the horizontal and vertical images seperately fom an image.If F is my original image then for getting its vertical image I have the equation
Dv_F(i,j)=Abs(F(i,j)-F(i-1,j)) for i=1 to m-1, j=0 to n-1
For horizontal image
Dh_F(i,j)=Abs(F(i,j)-F(i,j-1)) for j=1 to n-1, i=0 to m-1
How can I implement these in matlab? Its very urgent. Please someone help.

Risposte (1)

Turlough Hughes
Turlough Hughes il 15 Ott 2019
Modificato: Turlough Hughes il 15 Ott 2019
I'm not sure what you mean by vertical / horizontal image but from your equation it looks like you want to find the absolute difference of adjacent pixels to form a new image, first in the vertical direction and secondly in the horizontal direction. Let's a assume you have a grayscale image F, you can use the imabsdiff function
Dv_F=imabsdiff(F(1:end-1,:),F(2:end,:))
Dh_F=imabsdiff(F(:,1:end-1),F(:,2:end))
Please refer to the documentation on imabsdiff to confirm if this is what you are looking for.

Community Treasure Hunt

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

Start Hunting!

Translated by