MATLAB: How to draw a line across the centre of the barcode centroidimage processingMATLAB Original Image How to make the image to look like this?? Best Answer Hi,If my understanding of your question is not wrong.Irgb = imread('rhsr9t.jpg');Icrop = imcrop(Irgb,[75 25 670 500]);Igray = rgb2gray(Icrop);Ibw = im2bw(Igray,graythresh(Igray));Iarea = bwareaopen(Ibw,300);Idilate = imdilate(Iarea,strel('line',10,0));stat = regionprops(Idilate,'Centroid');linecoor = [0 stat.Centroid(2); stat.Centroid(1) stat.Centroid(2); size(Irgb,2) stat.Centroid(2)];imshow(Icrop); hold onplot(stat.Centroid(1),stat.Centroid(2),'ro','markersize',10,'linewidth',2);line(linecoor(:,1),linecoor(:,2),'linewidth',2,'color','g');And the result : Related SolutionsMATLAB: How can i separate all the connected regions in a binary image and display them individually. Use bwlabel() and ismember[labeledImage, numRegions] = bwlabel(binaryImage);props = regionprops(labeledImage, 'Area')% Compute all the areas.allAreas = [props.Area]% Display each blob in its own figure.for k = 1 : numRegions thisRegion = ismember(labeledImage, k); figure; imshow(thisRegion); drawnow;end MATLAB: How to increase or decrese graythresh value store graythresh(Igray) in a variable and increase/ descrease as u want! Related QuestionI am not getting the BoundingBoxThin the boundary of objects of black & white imagesHow to divide an image into upper and lower regionsNumber of Object in binary imageIntroducing a border/outline to objects in an image.
Best Answer