Remove Border or Pixel values of zero

3 views (last 30 days)
hi all,
I have this image and want to remove the black outline (the dark region) , i.e I need the square region in the box
I have tried using imclearborder() and other function
hold on
for i=1:r
for j=1:c
if (impixel(g,j,i)<1)
GRAY(i,j)='delete';
end
end
end
hold off
but still have a problem..can some one help me?? please?

Accepted Answer

Image Analyst
Image Analyst on 18 Oct 2014
Even if you do crop it, it's still tilted and you will still have black triangles at the edges, unless you straighten it with imwarp(). So, what do you want those black triangles to be? White? The mean of the gray noisy area? Some color? What exactly?
  5 Comments
Image Analyst
Image Analyst on 19 Oct 2014
Well you blew your chance by ignoring my request to help you "Can you post the original image" - I'll check back sometime later. In the meantime, simply threshold, label, and call regionprops to ask for bounding box. I'll check back later to see if you posted the original image. When you force people to do things like import your annotated image into Photoshop to fix it, then often they just don't bother. That's something you should do if you want help, not us.
Image Analyst
Image Analyst on 20 Oct 2014
Karthik:
Not sure if you're still interested in my help or not. But I wrote some code to produce the image I asked you to upload from the screenshot you did upload. Then I found the black surround and cropped it. See code attached below the image it produces:

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!