enter image description hereHow to crop the object in the image by black pixel or white pixel area. I want the idea or any code for this. Bounding box is in Matlab. But here we are not have the bounding box options.

Find the object scerew

x = Import["/home/karthi/Desktop/Length/5.jpg"];
adj = Sharpen[x];

I only tried this. Just I need to detect the black pixel area as bounding box


closed as unclear what you're asking by m_goldberg, Niki Estner, MarcoB, user9660, Öskå Nov 25 '15 at 19:18

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Please describe your problem in more detail, at the moment it is quite unclear what exactly you want to do. Optimally including code to show what you tried already. $\endgroup$ – Yves Klett Nov 25 '15 at 12:36
  • 1
    $\begingroup$ Err ... you have several black areas there. Or perhaps you posted the image after the MorphologicalBinarize[ ]? $\endgroup$ – Dr. belisarius Nov 25 '15 at 12:50
  • $\begingroup$ yes,But any way, I want the object area in the image $\endgroup$ – Muthu Kumar Nov 25 '15 at 12:59
  • $\begingroup$ This is my image @belisarius has settled $\endgroup$ – Muthu Kumar Nov 25 '15 at 13:13
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 0) Browse the common pitfalls question 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – Dr. belisarius Nov 25 '15 at 13:58
i = Import["http://i.stack.imgur.com/AsutA.jpg"];
tvf = TotalVariationFilter[i, Method -> "Laplacian"];
ImagePad[i, -BorderDimensions[
         Dilation[DeleteSmallComponents[EdgeDetect[tvf, .9]], 5]]]

Mathematica graphics

  • $\begingroup$ This crop image is not exactly comes, In top screw head is cut out in small length $\endgroup$ – Muthu Kumar Nov 25 '15 at 14:09
  • 2
    $\begingroup$ @MuthuKumar Add a safety padding as you see fit. Don't expect "please solve my problem completely" kind of answers in this site! $\endgroup$ – Dr. belisarius Nov 25 '15 at 14:13
  • $\begingroup$ Its OK. Am not say You are wrong. Just intimate to you. And try to know what is that error. Thats only @belisarius-has-settled $\endgroup$ – Muthu Kumar Nov 25 '15 at 14:14
  • $\begingroup$ @MuthuKumar There is no "error", but just a boundary adjustment (very usual when using image processing methods). That said, there you have it. $\endgroup$ – Dr. belisarius Nov 25 '15 at 14:20
  • $\begingroup$ Ya ok. If you are ok. Please accept my invite in @belisarius-has-settled $\endgroup$ – Muthu Kumar Nov 25 '15 at 14:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.