필터 지우기
필터 지우기

Find a black pixel's position on multiple images

조회 수: 2 (최근 30일)
mael thevenot
mael thevenot 2018년 4월 27일
댓글: khaled abdessalem 2020년 1월 7일
Hi,
I have an film of an object (black pixels) that move (background in white pixels). From this film i've exported all images, I have a folder with a lot of black and white images.
I'm using a loop with this to "load images in matlab" and it seems to work :
string= [num2str(i) '.jpg'];
I=imread(string);
Then what I would like to do is a loop and for each image, find the y position of the first black pixel of a specific column (i'm trying to observe an axial displacement, from top to bottom). Store the y value for each image and at the end plot the y position vs the time.
But I don't konw how in a loop I could say for each image "on x = 40, find from the top the first black pixel and store this value"?
Any help would be appreciated
Thanks
  댓글 수: 1
khaled abdessalem
khaled abdessalem 2020년 1월 7일
Hi Mael
please I need the conmplet matlab function that you use to plot y position vs the time for 120 images
All the best

댓글을 달려면 로그인하십시오.

채택된 답변

Ameer Hamza
Ameer Hamza 2018년 4월 27일
Outside the for loop initialize a variable Y as
Y = zeros(1, m); % here m is total number of images. I am assuming that you already know this in advance. Otherwise use Y = []
Then under the following line add
string= [num2str(i) '.jpg'];
I=imread(string);
columnNumber = ; %define the column number you want to check
Y(i) = find( I(:, columnNumber) == 0, 1); % find first 0 pixel in specified column
% again here i am assuming that i goes from 1:m in for loop
  댓글 수: 5
mael thevenot
mael thevenot 2018년 4월 27일
Ok it work just fine and I now understand how it works :) Thanks you very much for your help you explined it very nicely.
Ameer Hamza
Ameer Hamza 2018년 4월 27일
You are welcome.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by