Looking for a suitable image and video processing method for seam tracking

조회 수: 1 (최근 30일)
Hi everybody, I am trying to implement a seam tracking algorithm using image processing (please check attached files); I have tried many methods that are working but I still think that I can do better (yet my codes aren't always working properly and I get some bugs). I attach images and if you want to see a video of the process please contact me (husseinpourmina@gmail.com) I want two detect the disks and mark a point between them as the seam. ROI is shown in the circle and the pixels that are on the left side of the red line, are not a part of ROI and must be ignored and I need to track the green point in a live video. (If you think you can help me, please email me to send a video file.) P.S: I attached the file of my code, please check and leave a comment if you know a better way to track the seam position.
  댓글 수: 2
Image Analyst
Image Analyst 2021년 10월 31일
Attach a short video in a .zip file, or else attach an image for which your algorithm does not work well.
Image Analyst
Image Analyst 2021년 10월 31일
What exactly is the disc? Is it the dumbbell-shaped blob in the middle? What do you need to measure? The weighted centroid of the dumbbell for each frame?

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

채택된 답변

yanqi liu
yanqi liu 2021년 11월 1일
편집: yanqi liu 2021년 11월 1일
sir,please check the follow code to get some information
% This code opens all the frames of the video and pre-precesses them
clc
clear all
close all
%%
% Read the video file
V = VideoReader('video.mpg');
fcount = 0;
while hasFrame(V)
frame = readFrame(V);
im = rgb2gray(frame);
bw = im2bw(im, 0.8);
[L,num] = bwlabel(bw);
stats = regionprops(L);
for j = 1 : num
recti = stats(j).BoundingBox;
% target filter
if recti(4)>size(bw,1)*0.1 || recti(2) < size(bw,1)*0.3
bw(L==j) = 0;
end
end
[~,num] = bwlabel(bw);
if num < 2
bw = im2bw(im, 0.85);
[L,num] = bwlabel(bw);
stats = regionprops(L);
for j = 1 : num
recti = stats(j).BoundingBox;
% target filter
if recti(4)>size(bw,1)*0.1 || recti(2) < size(bw,1)*0.3
bw(L==j) = 0;
end
end
end
bw = logical(bw);
% other filter
bw2 = imclose(bw, strel('line', round(size(bw,1)*0.2), 90));
bw2 = bwareaopen(bw2, 100);
[r,c] = find(bw2);
[~,ind] = min(c);
if ~isempty(ind)
bw2 = bwselect(bw2, c(ind), r(ind));
bw = logical(bw.*bw2);
end
[L,num] = bwlabel(bw);
if num > 2
bw = bwareaopen(bw, 3);
[L,~] = bwlabel(bw);
end
stats = regionprops(L);
rects = cat(1, stats.BoundingBox);
[~,ind] = sort(rects(:,2));
bw(L~=ind(1)&L~=ind(2)) = 0;
bw = logical(bw);
[L,num] = bwlabel(bw);
stats = regionprops(L);
cens = cat(1, stats.Centroid);
frame2 = insertMarker(frame,cens,'x','color','red','size',6);
figure(1); imshow(frame2, []);
fcount = fcount +1
title(num2str(fcount));
pause(0.00001);
end
  댓글 수: 4
yanqi liu
yanqi liu 2021년 11월 2일
yes,may be give me an email address,i would send the zip file
yanqi liu
yanqi liu 2021년 11월 3일
편집: yanqi liu 2021년 11월 3일
sorry, the email can not seed success,so upload,please check

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by