# How to get the cross sectional area of a wine bottle picture/photo by doing an appropiate image processing on it?

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.

To something like this (manually constructed geometry).

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.

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


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?

• > 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? Commented Aug 19, 2022 at 15:42
• 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? Commented Aug 19, 2022 at 15:43
• @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. Commented Aug 19, 2022 at 19:57
• @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. Commented Aug 19, 2022 at 23:00
• I will attempt to provide a solution today after work…hopefully nobody solves it before then! Commented Aug 22, 2022 at 7:18