Hi, im problem to get an accurate image for this coding. I need help to finish my final year project.
clear all
% baca image ori
a = imread('C:\Users\nazmiz\Desktop\PCB Tester\TestedPCB\Original.jpg');
a1 = im2bw(a,0.5)
imshow(a1)
% baca image nak test
b = imread('C:\Users\nazmiz\Desktop\PCB Tester\TestedPCB\Test.jpg');
b1 = im2bw(b,0.5)
imshow(b1)
% buat subtraction dapatkan beza
c = imabsdiff(a1,b1);
imshow(c)
d = imcomplement(c);
imshow(d)
%e = regionprops(c,'centroid');
%centroids = cat(1,e.Centroid);
e = regionprops('table',c,'Centroid','MajorAxisLength','MinorAxisLength')
centers = e.Centroid;
diameters = mean([e.MajorAxisLength e.MinorAxisLength],2);
radii = diameters/2;
subplot(3,3,1), imshow(a), title('Original')
subplot(3,3,2), imshow(b), title('Test')
subplot(3,3,3), imshow(c), title('Difference')
subplot(3,3,4), imshow(d), title('Inverted Difference')
subplot(3,3,5), imshow(b)
hold on
viscircles(centers,radii);
%plot(centroids(:,1),centroids(:,2),'b*')
hold off
title('Labeled')
Original.jpg
Test.jpg

댓글 수: 1

MUHAMMAD NAZMI ZAINAL AZALI
MUHAMMAD NAZMI ZAINAL AZALI 2019년 11월 25일
and i need help to crop to the accurate image of the circuit

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

답변 (1개)

Image Analyst
Image Analyst 2019년 11월 25일

0 개 추천

Attached is a start. It looks bad because you provided a heavily compressed JPEG image with uber-bad artifacts.
0000 Screenshot.png

댓글 수: 5

MUHAMMAD NAZMI ZAINAL AZALI
MUHAMMAD NAZMI ZAINAL AZALI 2019년 11월 26일
so, the coding is right, but i need a better quality of the picture? actually his image i from webcam then the coding need to process the image.
Image Analyst
Image Analyst 2019년 11월 26일
Use a better camera. Don't save as JPEG. Use better lighting and lenses.
MUHAMMAD NAZMI ZAINAL AZALI
MUHAMMAD NAZMI ZAINAL AZALI 2019년 11월 26일
can you recommend the best format that i need to save? may i know how to make a counter capture thus crop the region that i want?
MUHAMMAD NAZMI ZAINAL AZALI
MUHAMMAD NAZMI ZAINAL AZALI 2019년 11월 26일
Actually this is my GUI
Image Analyst
Image Analyst 2019년 11월 26일
I use PNG format whenever I can. I think most people do. It's pretty much the de facto standard these days.

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

카테고리

도움말 센터File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

태그

질문:

2019년 11월 25일

댓글:

2019년 11월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by