Remove Border or Pixel values of zero

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?

 Respuesta aceptada

Image Analyst
Image Analyst el 18 de Oct. de 2014

0 votos

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 comentarios

Image Analyst
Image Analyst el 18 de Oct. de 2014
Karthik's answer moved here:
I want the black area to completely be removed and only the grey area should be there, some thing like the image I have attached
thanks
Image Analyst
Image Analyst el 18 de Oct. de 2014
Can you post the original image without the white surround and annotation/caption? Also, is it okay to crop off (i.e. lose) a little bit of the tilted square to get an image with no black surround? If not, you're stuck using imwarp().
Karthik Thiyagarajan
Karthik Thiyagarajan el 19 de Oct. de 2014
Editada: Karthik Thiyagarajan el 19 de Oct. de 2014
hi I have used imwrap. it is not what I need, Yes I can lose little information for getting square with no black ground
can you see in my first post there is a gray square image with black box. I wan to remove that black box. so that the image would look some thing like in the previous comment
HOW TO REMOVE THE BLACK BOX.
Image Analyst
Image Analyst el 19 de Oct. de 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 el 20 de Oct. de 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:

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Images en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 18 de Oct. de 2014

Comentada:

el 20 de Oct. de 2014

Community Treasure Hunt

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

Start Hunting!

Translated by