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

4 ビュー (過去 30 日間)
N/A
N/A 2021 年 10 月 31 日
編集済み: yanqi liu 2021 年 11 月 3 日
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