Closed mxochicale closed 2 years ago
In our weekly meeting, AG mentions that the bound box can we made as shown below where the black area can be randomised pixels to avoid the net converging to values that are not relevant. Similarly, bound box can be either a bit in the centre with different percentages that relate to the area to be cropped.
MX will implement methods for bounding box with different percentages and a small benchmark on computation cost of the cropping.
Ideas to consider for cropping from Alberto's comments:
Few references that might help to crop relevant US image sections
🚀 Feature
Masking relevant sections of the captured video frame will lead to use different methods for the following potentials regions of interest:
US image arc shape
The current implementation to mask
US image arc shape
is a manual one which limitation will come when US beams are for different field of view and depth. That said, AG suggest the use ofconvex hull
of opencv and the average of various frames to get the right mask. For the use of convex hull and image filter, MX mentions that might be impacted with different contrast or gain and modes of US settings.Calipers
Chen et al. 2020 in frontiers of Neurology proposed a Mask R-CNN[11] which can automatically detect and segment the caliper and the fetal lateral ventricles (LVs) simultaneously. Although Mask R-CNN sounds promising, but maybe we will only apply to our work few for the following pre-processing techniques to enhance calipers and compute PPC: (01) intercept of the caliper in the raw image (02) crop the caliper using the bounding box given by Mask R-CNN, (03) conversion to gray-scale, (04) edge detection by the Laplace operator, (05) binarize the gray-scale image using a threshold value of 127 to obtain a monochrome image, (06) perform a morphological open operation on the monochrome image to eliminate a small amount of background noise, (07) minimize background noise and all contours in the image with “findContours” function of OpenCV (08) filter out the contours that have pixel numbers larger than the threshold value of 30, i.e., the large background contours that have not been cleaned by the morphological processing (09) filtering out the small and medium contours of the US image in order to "count the contours that intersect with each y-axis by traversing all y-axes in the caliper image". (10) the mode is obtained as the pixel distance between adjacent scales via calculating and recording the distance between adjacent contours. The position of each contour is represented by the point at the upper left corner of the contour (11) "Finally, all scale contours are obtained via the pixel distance, and the “minAreaRect” function of OpenCV is utilized to generate a rectangular bounding box for each scale contour, to filter out the small contours between scales." [11] He K, Gkioxari G, Dollár P, Girshick R. Mask R-CNN. In: Proceedings of the IEEE International Conference on Computer Vision. Venice (2017). p. 2961–9. doi: 10.1109/ICCV.2017.322. https://scholar.google.com/scholar?cites=16324699838103945745&as_sdt=2005&sciodt=0,5&hl=en
references from a quick seach
/how-to-find-corners-on-a-image-using-opencv https://stackoverflow.com/questions/7263621/how-to-find-corners-on-a-image-using-opencv
Canny edge detection https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_canny/py_canny.html
Harris corner detection https://docs.opencv.org/3.0-beta/doc/py_tutorials/py_feature2d/py_features_harris/py_features_harris.html
4-point-opencv-getperspective-transform-example/ https://www.pyimagesearch.com/2014/08/25/4-point-opencv-getperspective-transform-example/
imreg_dft is your first-choice Python image registration utility. In plain language, it implements means of guessing translation, rotation and scale variation between two images. The name comes from the fact that it doesn’t work with those images directly, but it works with their spectrum (DFT using FFT), and its log-polar transformation [1], hence the _dft after imreg. https://pypi.org/project/imreg_dft/#id1 https://github.com/matejak/imreg_dft
AG shares https://pypi.org/project/itk-pocus/ https://github.com/KitwareMedical/ITKPOCUS as tools to extract the caliper of the video. Particularly, he points out to look to:
Motivation
Pitch
Alternatives
Additional context