4
$\begingroup$

We are working on a PDE Acoustic model in which the geometry of analysis is the cross-sectional area of a wine bottle. We want to get the geometry from a wine bottle image by doing an appropriate image processing on it and have some trouble with it. We need to get from something like this.

enter image description here

To something like this (manually constructed geometry).

enter image description here

We have edited the bottle in another app to get rid of the reflections and text on the bottle - not sure how we'd do this in Mathematica. Would be ideal to also do this in Mathematica. This image is saved as imagefull.

enter image description here

imagebi = ChanVeseBinarize[imagefull]
imagehalf = ImageTake[imagebi, {0, 1600}, {759/2, 759}]
m = ImageMesh[imagehalf]

enter image description here

How could we get rid of the curved mouth and the curved bottom in the images? Is there perhaps a way to map the image in such a way that the form more closely resembles the manually generated geometry? Are there any other suggestions to improve the image processing of the picture?

$\endgroup$
6
  • 4
    $\begingroup$ > How could we get rid of the curved mouth and the curved bottom in the images? Silly answer, but could you just take the photograph normal to the bottle? $\endgroup$ Commented Aug 19, 2022 at 15:42
  • 6
    $\begingroup$ Welcome to Mathematica StackExchange! What is the final purpose of your analysis? Do you need your wine bottle outline to be a very accurate representation of the bottle? In this case, you should probably solve the problem at the photography stage by using a very long lens which will diminish the effects of perspective. Or do you just want to have some approximate shape? $\endgroup$
    – Domen
    Commented Aug 19, 2022 at 15:43
  • 1
    $\begingroup$ @JoshuaSchrier, I'd think that even when you take picture normal to the bottle, you'd still see the curvature of the bottom. Maybe not as pronounced but still there. I think this is an interesting problem. $\endgroup$
    – user21
    Commented Aug 19, 2022 at 19:57
  • $\begingroup$ @Domen, The final purpose is to get the cross-sectional area and transform it into a mesh, so later on be able to use it in an Acoustic FEM analysis and simulate a Helmholtz resonator. We would like to skip the part about taking the best photograph and try to solve it with Mathematica. An approximate shape can be valid, as long as it has the same shape as the manually generated geometry. $\endgroup$
    – Bastian27
    Commented Aug 19, 2022 at 23:00
  • 1
    $\begingroup$ I will attempt to provide a solution today after work…hopefully nobody solves it before then! $\endgroup$ Commented Aug 22, 2022 at 7:18

1 Answer 1

1
$\begingroup$

The most direct solution is to use a particular type of lens to take the input picture, a telecentric lens. A telecentric lens is commonly used to 'flatten' pictures for machine vision. It removes the convergent lines which give you the curves you see in an image. I have used this solution in the past for machine vision inspection issues. It can also be calibrated to be 'metric' - able to directly measure dimensions when used at a fixed distance from the object.

See:

https://www.edmundoptics.com/knowledge-center/application-notes/imaging/advantages-of-telecentricity/

No lens recommendation implied, but a good source for your background.

$\endgroup$
2
  • 2
    $\begingroup$ This may be good advice, but it does not answer the OP's question. $\endgroup$
    – bbgodfrey
    Commented Aug 23, 2022 at 19:53
  • 1
    $\begingroup$ Do you know if there is a telecentric lens in software? $\endgroup$
    – user21
    Commented Aug 24, 2022 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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