image-processing

Set Label in Java to Image-Format Issue

走远了吗. 提交于 2021-02-05 08:07:43
问题 I am trying to set the label in a java program to an image. It seems, however, that it does not work for .bmp images I am looking for a converter which will allow me to convert an image from a .bmp to a .jpg with the same file name. This converter needs to be controlled by the java program, which has the name and location of the image that needs to be converted. Any help would be greatly appreciated as I have spent hours on this :P Thanks *Edit: The program needs to be able to be packaged

How to count number of white and black pixels in color picture in python? How to count total pixels using numpy

和自甴很熟 提交于 2021-02-05 06:13:45
问题 I want to calculate persentage of black pixels and white pixels for the picture, its colorful one import numpy as np import matplotlib.pyplot as plt image = cv2.imread("image.png") cropped_image = image[183:779,0:1907,:] 回答1: You don't want to run for loops over images - it is dog slow - no disrespect to dogs. Use Numpy. #!/usr/bin/env python3 import numpy as np import random # Generate a random image 640x150 with many colours but no black or white im = np.random.randint(1,255,(150,640,3),

Using regionprops in Python

徘徊边缘 提交于 2021-02-04 19:59:36
问题 I am trying to analyze greyscale TIFF stacks, in which a given frame will look like this. I filter it (using Gaussian blur), and then binarize it (using Otsu's method for threshold). MATLAB code, which works great: image_conncomp = bwconncomp(image_binary); # entire stack is held in image_binary for i=1:image_conncomp.NumObjects object_size = length(image_conncomp.PixelIdxList{i}); end Each white spot in the example image is picked up, and its volume (in pixels) is pretty accurately given by

Using regionprops in Python

那年仲夏 提交于 2021-02-04 19:59:32
问题 I am trying to analyze greyscale TIFF stacks, in which a given frame will look like this. I filter it (using Gaussian blur), and then binarize it (using Otsu's method for threshold). MATLAB code, which works great: image_conncomp = bwconncomp(image_binary); # entire stack is held in image_binary for i=1:image_conncomp.NumObjects object_size = length(image_conncomp.PixelIdxList{i}); end Each white spot in the example image is picked up, and its volume (in pixels) is pretty accurately given by

Remove top section of image above border line to detect text document

ε祈祈猫儿з 提交于 2021-02-04 19:47:06
问题 Using OpenCV (python) I am trying to remove the section of image which is above the border line (white area in this sample image where ORIGINAL is writtn) in the image shown below Using horizontal and vertical kernels I am able to draw the wireframe, however that does not work many times because many times due to scanning quality few horizontal or vertical lines appear outside the wireframe which causes wrong contour detection. In this image also you can see on top right there is noise which

SimpleITK Resize images

[亡魂溺海] 提交于 2021-02-04 14:08:07
问题 I have a set o 3D volumes that I am reading with SimpleITK import SimpleITK as sitk for filename in filenames: image = sitk.ReadImage(filename) Each of the volumes has different size, spacing, origin and direction. This code yields different values for different images: print(image.GetSize()) print(image.GetOrigin()) print(image.GetSpacing()) print(image.GetDirection()) My question is: how do I transform the images to have the same size and spacing so that they all have the same resolution

SimpleITK Resize images

社会主义新天地 提交于 2021-02-04 14:06:43
问题 I have a set o 3D volumes that I am reading with SimpleITK import SimpleITK as sitk for filename in filenames: image = sitk.ReadImage(filename) Each of the volumes has different size, spacing, origin and direction. This code yields different values for different images: print(image.GetSize()) print(image.GetOrigin()) print(image.GetSpacing()) print(image.GetDirection()) My question is: how do I transform the images to have the same size and spacing so that they all have the same resolution

SimpleITK Resize images

故事扮演 提交于 2021-02-04 14:05:31
问题 I have a set o 3D volumes that I am reading with SimpleITK import SimpleITK as sitk for filename in filenames: image = sitk.ReadImage(filename) Each of the volumes has different size, spacing, origin and direction. This code yields different values for different images: print(image.GetSize()) print(image.GetOrigin()) print(image.GetSpacing()) print(image.GetDirection()) My question is: how do I transform the images to have the same size and spacing so that they all have the same resolution

Creating rectangle within a blob using OpenCV

爱⌒轻易说出口 提交于 2021-02-04 13:52:14
问题 Input Image: Output Image: I have several colored blobs in an image and I'm trying to create rectangles (or squares--which seems to be much easier) inside the largest blob of each color. I've found the answer to how to create a rectangle that bounds a single largest blob, but am unsure as to how to find a square that simply fits inside a blob. It doesn't have to be the largest, it just has to be larger than a certain area otherwise I just won't include it. I've also seen some work done on

How to calculate mean color of image in numpy array?

不羁的心 提交于 2021-02-04 13:11:05
问题 I have an RGB image that has been converted to a numpy array. I'm trying to calculate the average RGB value of the image using numpy or scipy functions. The RGB values are represented as a floating point from 0.0 - 1.0, where 1.0 = 255. A sample 2x2 pixel image_array: [[[0.0, 0.0, 0.0], [0.0, 0.0, 0.0]], [[1.0, 1.0, 1.0], [1.0, 1.0, 1.0]]] I have tried: import numpy numpy.mean(image_array, axis=0)` But that outputs: [[0.5 0.5 0.5] [0.5 0.5 0.5]] What I want is just the single RGB average