image-processing

Trying to segment characters using opencv - Ilumination problem

╄→尐↘猪︶ㄣ 提交于 2020-06-26 13:35:06
问题 My code it's not detecting well binary image! LpImg = cv2.imread('/content/drive/My Drive/TESTING/Placas_detectadas/CPVL92.png') if (len(LpImg)): #check if there is at least one license image # Scales, calculates absolute values, and converts the result to 8-bit. plate_image = cv2.convertScaleAbs(LpImg[0], alpha=(255.0)) plate_image = LpImg #image_cropped # convert to grayscale and blur the image gray = cv2.cvtColor(plate_image, cv2.COLOR_BGR2GRAY) blur = cv2.GaussianBlur(gray,(7,7),0) #

Is there a way to set specific compression scheme when saving tiff file in opencv?

。_饼干妹妹 提交于 2020-06-26 07:19:17
问题 I'm using opencv to crop tif files, everthing is fine, except for saving image to a file - opencv always uses LZW compression, but i don't need compression on resulting files, i do appreciate opencv's help in saving my disk drive space, but now is not the right time to do it. So is there a way to save tif files with specific compression scheme (including no compression) or no? Original images have no compression scheme applied and i'm using ROI to select area and SaveImage to save it to the

Pytorch RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 0

*爱你&永不变心* 提交于 2020-06-26 03:08:13
问题 I use code from here to train a model to predict printed style number from 0 to 9 : idx_to_class = {0: "0", 1: "1", 2: "2", 3: "3", 4: "4", 5: "5", 6: "6", 7:"7", 8: "8", 9:"9"} def predict(model, test_image_name): transform = image_transforms['test'] test_image = Image.open(test_image_name) plt.imshow(test_image) test_image_tensor = transform(test_image) if torch.cuda.is_available(): test_image_tensor = test_image_tensor.view(1, 3, 224, 224).cuda() else: test_image_tensor = test_image_tensor

Maximum of multiple images or arrays in Julia

旧时模样 提交于 2020-06-26 01:39:43
问题 I want to find a maximum of several images: load them into an array and find a maximum along first dimension. Python code for example: import cv2 import sys import numpy as np imgs_paths = sys.argv[1:] imgs = list(map(cv2.imread, imgs_paths)) imgs_arr = np.array(imgs, dtype=np.float32) imgs_max = np.max(imgs_arr, 0) What I did is the following: using Colors, Images function im_to_array(im) img_array = permutedims(channelview(im), (2,3,1)) img_array = Float32.(img_array) return img_array end

Maximum of multiple images or arrays in Julia

£可爱£侵袭症+ 提交于 2020-06-26 01:34:40
问题 I want to find a maximum of several images: load them into an array and find a maximum along first dimension. Python code for example: import cv2 import sys import numpy as np imgs_paths = sys.argv[1:] imgs = list(map(cv2.imread, imgs_paths)) imgs_arr = np.array(imgs, dtype=np.float32) imgs_max = np.max(imgs_arr, 0) What I did is the following: using Colors, Images function im_to_array(im) img_array = permutedims(channelview(im), (2,3,1)) img_array = Float32.(img_array) return img_array end

Adding text to image and save

倾然丶 夕夏残阳落幕 提交于 2020-06-25 03:55:51
问题 In my program i allow the user to enter some text which then gets put on top of an image using the graphics.DrawString() method. When i then go to save this image, it saves it without the text. How can i save both as one image? I have seen a few examples but none of which have helped. private void txtToolStripMenuItem_Click(object sender, System.EventArgs e) { Rectangle r = new Rectangle(535, 50, original_image.Width, original_image.Height); Image img = Image.FromFile("C:\\PCB.bmp"); Bitmap

Copy and paste region of image in opencv?

拜拜、爱过 提交于 2020-06-25 01:27:27
问题 I'm stuck at this tutorial where a ROI is pasted over another region of same image. Python trows a value error when I try something similar: img = cv2.imread(path, -1) eye = img[349:307, 410:383] img[30:180, 91:256] = eye Exeption: Traceback (most recent call last): File "test.py", line 13, in <module> img[30:180, 91:256] = eye ValueError: could not broadcast input array from shape (0,0,3) into shape (150,165,3) This might be very newb question, but I couldn't come up with an answer by

Copy and paste region of image in opencv?

别来无恙 提交于 2020-06-25 01:27:19
问题 I'm stuck at this tutorial where a ROI is pasted over another region of same image. Python trows a value error when I try something similar: img = cv2.imread(path, -1) eye = img[349:307, 410:383] img[30:180, 91:256] = eye Exeption: Traceback (most recent call last): File "test.py", line 13, in <module> img[30:180, 91:256] = eye ValueError: could not broadcast input array from shape (0,0,3) into shape (150,165,3) This might be very newb question, but I couldn't come up with an answer by

How to find shortest path in skeletonized maze image?

混江龙づ霸主 提交于 2020-06-24 12:55:36
问题 I am working on maze solving using Image Processing and NetworkX search algroithm and need to find the shortest connecting path between two points on those lines. #Solving Maze Using Image Processing and NetWorkx search #Open Maze image img = cv2.imread("C:/Users/Dell/HandMadeMaze1.jpg") kernel = np.ones((1,1),np.uint8) #Convert to GrayScaledImage grayscaled = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) #BınaryThreshold + OtsuThreshold + BinaryThreshold retval, threshold = cv2.threshold(grayscaled,

Why is PIL's Image.fromarray() distorting my image color? [duplicate]

无人久伴 提交于 2020-06-22 02:29:06
问题 This question already has answers here : OpenCV giving wrong color to colored images on loading (2 answers) Closed 11 days ago . I am generating thumbnails for mp4 videos using the following code: import cv2 as cv from PIL import Image vidcap = cv.VideoCapture(videoPath) vidcap.set(cv.CAP_PROP_POS_MSEC, millisecond) #Turn video frame into numpy ndarray success, image = vidcap.read() cv.imwrite('fromImage.jpg', image) #line to be replaced The thumbnail generated from a high budget,