binary-image

Cannot convert to binary image using otsu threshold

最后都变了- 提交于 2020-06-17 14:19:05
问题 I am trying to convert zebra crossing image into binary image through otsu method. At first I have counted threshold value of all the zebra crossing images in the folder and then append it to a list called th_li=[] import cv2 as cv from skimage.filters import threshold_otsu dir3=r"C:\Users\USER\Handcrafted dataset\bw" images3=[cv2.imread(file,cv2.IMREAD_GRAYSCALE) for file in sorted(glob.glob(r"C:\Users\USER\Handcrafted dataset\adaptive/*.jpg"))] th_li=[] for i,img in enumerate(images3):

OpenCV Save a Mat as Binary (1-bit depth) TIFF

折月煮酒 提交于 2019-12-23 18:16:57
问题 Suppose we have a Mat after applying the OpenCv's Imgproc.adaptiveThreshold : Mat srcImage = ...; Mat binaryImage = new Mat(); Imgproc.adaptiveThreshold(srcImage, binaryImage, 255, Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C, Imgproc.THRESH_BINARY, THRESHOLD_BLOCK_SIZE, 10); When I save the binaryImage using Highgui.imwrite : boolean isOk = Highgui.imwrite("sample.tiff", binaryImage); Everything is ok except that output TIFF is not actually a binary TIFF - it's a 8-bit depth image: What I'm trying to

Remove noise in BW image

谁都会走 提交于 2019-12-11 06:14:56
问题 I used MATLAB to generate this image (using bwareaopen ). In the middle I have a 2D ellipsoid. How can I clear all the "noise" surrounding of it and get a clear ellipsoid? original image 回答1: Have a look at this solution. As mentioned in the comments I used DoG - Difference of Gaussians What does DoG mean ? First you have to take two separate Gaussians of an image with two separate kernels. (By Gaussian I mean apply ing gaussian blur ). The difference of the two resultants is called the DoG .

Detect High density pixel areas in a binary image [closed]

不问归期 提交于 2019-12-10 12:28:05
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . I am doing background subtraction, and I obtain a binary image with foreground objects and with some noise. I want to obtain a ROI for each object on the binary image and them analyze it to ensure that is the object that I want. How do I segment only the areas with high pixel

connected components attributes in python

落花浮王杯 提交于 2019-12-08 04:54:52
问题 I want to compute statistics on the connected components of a binary image. In matlab we have Shape Measurements 'Area' 'EulerNumber' 'Orientation' 'BoundingBox' 'Extent' 'Perimeter' 'Centroid' 'Extrema' 'PixelIdxList' 'ConvexArea' 'FilledArea' 'PixelList' 'ConvexHull' 'FilledImage' 'Solidity' 'ConvexImage' 'Image' 'SubarrayIdx' 'Eccentricity' 'MajorAxisLength' 'EquivDiameter' 'MinorAxisLength' Is there any equivalent in python? Thanks 回答1: Just answered a similar question. Use the

How do I save the XY coordinates of a Binary Image in R?

喜欢而已 提交于 2019-12-07 22:41:07
问题 I am trying to save the XY coordinates of a binary image in R similarly to the save "Save XY Coordinates" function in ImageJ. I've looked through several image analysis packages available for R, but haven't yet figured out how to accomplish this. 回答1: There are many ways to do the following in R: img_fil <- "~/data/ZjYqw.jpg" img <- magick::image_read(img_fil) img_df <- RSAGA::grid.to.xyz(as.matrix(as.raster(img))) head(img_df) ## x y z ## 1 0 599 #ffffff ## 2 1 599 #ffffff ## 3 2 599 #ffffff

How do I save the XY coordinates of a Binary Image in R?

蹲街弑〆低调 提交于 2019-12-06 11:14:29
I am trying to save the XY coordinates of a binary image in R similarly to the save "Save XY Coordinates" function in ImageJ. I've looked through several image analysis packages available for R, but haven't yet figured out how to accomplish this. There are many ways to do the following in R: img_fil <- "~/data/ZjYqw.jpg" img <- magick::image_read(img_fil) img_df <- RSAGA::grid.to.xyz(as.matrix(as.raster(img))) head(img_df) ## x y z ## 1 0 599 #ffffff ## 2 1 599 #ffffff ## 3 2 599 #ffffff ## 4 3 599 #ffffff ## 5 4 599 #ffffff ## 6 5 599 #ffffff 来源: https://stackoverflow.com/questions/39562605

How can I put margins in an image?

核能气质少年 提交于 2019-11-27 08:06:54
问题 I have a binary image of 18x18 pixels and I want to put margins around this image with the purpose of obtaining an image 20x20 pixels. The image is binary and it can be represented by a matrix of 1s and 0s. The 0 pixels are in black colour and the 1 pixels are in white colour. I need to put margins of 1 pixel of zeros around the image that I have. How can I do it? 回答1: Let's get hackish: %// Data: A = magic(3); %// example original image (matrix) N = 1; %// margin size %// Add margins: A(end