OpenCV

Extract tiles from tiled TIFF and store in numpy array

走远了吗. 提交于 2021-01-29 02:05:40
问题 My overall goal is to crop several regions from an input mirax (.mrxs) slide image to JPEG output files. Here is what one of these images looks like: Note that the darker grey area is part of the image, and the regions I ultimately wish to extract in JPEG format are the 3 black square regions. Now, for the specifics: I'm able to extract the color channels from the mirax image into 3 separate TIFF files using vips on the command line: vips extract_band INPUT.mrxs OUTPUT.tiff[tile,compression

ValueError: setting an array element with a sequence when array is not a sequence

混江龙づ霸主 提交于 2021-01-29 01:30:19
问题 Hello this code is intended to store the coordinates of rectangles drawn with open cv and compile the results into a single image. import numpy as np import cv2 im = cv2.imread('1.jpg') im3 = im.copy() gray = cv2.cvtColor(im,cv2.COLOR_BGR2GRAY) blur = cv2.GaussianBlur(gray,(5,5),0) thresh = cv2.adaptiveThreshold(blur,255,1,1,11,2) contours,hierarchy = cv2.findContours(thresh,cv2.RETR_LIST,cv2.CHAIN_APPROX_SIMPLE) squares = [] for cnt in contours: if cv2.contourArea(cnt)>50: [x,y,w,h] = cv2

OpenCV match template only on a specified grid of positions

六月ゝ 毕业季﹏ 提交于 2021-01-29 00:50:29
问题 I have a program where I get one image as input and I have to compare it with ~640 known images to see which one is the most similar. To do this I was thinking of using OpenCV's match template, as it seems very fast and effective in doing what I want to do. I noticed that matching two images, both 400x240 px, 1000 times is much slower than matching a 400x240 px image in a 1400x240 px, despite both of them being 1000 matches. My idea was to combine the 640 images in one big image containing

OpenCV match template only on a specified grid of positions

橙三吉。 提交于 2021-01-29 00:37:26
问题 I have a program where I get one image as input and I have to compare it with ~640 known images to see which one is the most similar. To do this I was thinking of using OpenCV's match template, as it seems very fast and effective in doing what I want to do. I noticed that matching two images, both 400x240 px, 1000 times is much slower than matching a 400x240 px image in a 1400x240 px, despite both of them being 1000 matches. My idea was to combine the 640 images in one big image containing

Opencv integration in Android studio for app development

*爱你&永不变心* 提交于 2021-01-28 22:33:58
问题 How to integrate opencv in Android Studio? I am facing problem in importing and installing opencv library in android studio 回答1: Install openCV in Android Studio Simple Steps:- (Indirect Method) Download/Install(Extract) OpenCV for Android (you might already have it) Download :-here Documentation :- here Version 2.4.11 is recommended. Open you Android Project on Android Studio. Import Module ( Files >> New >> Import Module ) Browse the path to the samples Folder inside OpenCV for Android

Android App use HED with OpenCV and Deep Learning(Java)

最后都变了- 提交于 2021-01-28 21:58:46
问题 I am developing an android app to scan documents with my phone. I am using openCV and Canny edge detection and it works ok but if I try to scan an document on a background without enough contrast between the document and the background it fails. I have tried other apps in the Play Store and they are still able to scan the document with less contrast. So I was looking for ways to improve my edge detection and found this: https://www.pyimagesearch.com/2019/03/04/holistically-nested-edge

OpenCV(4.0.0) assertion failed in function 'contourArea'

左心房为你撑大大i 提交于 2021-01-28 21:12:08
问题 My aim is to identify car logos using HOG descriptors. I am following tutorial linked https://gurus.pyimagesearch.com/lesson-sample-histogram-of-oriented-gradients-and-car-logo-recognition/# . I have testing and training images in separate folders. While extracting HOG features using following code: # import the necessary packages from sklearn.neighbors import KNeighborsClassifier from skimage import exposure from skimage import feature from imutils import paths import argparse import imutils

Aruco tutorial code does not compile

你。 提交于 2021-01-28 21:07:55
问题 Hello I am getting an error when using aruco. I am just trying to get an example from the tutorial working. I did everything according to the tutorial but I get: /home/pi/Programs/markerDetection/markerDetection.cpp: In function ‘int main(int, char**)’: /home/pi/Programs/markerDetection/markerDetection.cpp:26:104: error: invalid initialization of reference of type ‘cv::Ptr<cv::aruco::Dictionary>&’ from expression of type ‘cv::aruco::Dictionary’ aruco::detectMarkers(inputImage, dictionary,

OpenCV(4.0.0) assertion failed in function 'contourArea'

吃可爱长大的小学妹 提交于 2021-01-28 20:45:17
问题 My aim is to identify car logos using HOG descriptors. I am following tutorial linked https://gurus.pyimagesearch.com/lesson-sample-histogram-of-oriented-gradients-and-car-logo-recognition/# . I have testing and training images in separate folders. While extracting HOG features using following code: # import the necessary packages from sklearn.neighbors import KNeighborsClassifier from skimage import exposure from skimage import feature from imutils import paths import argparse import imutils

how to i specify the upper and the lower value of a color in HSV opencv python

吃可爱长大的小学妹 提交于 2021-01-28 20:13:41
问题 I found way to convert RGB to HSV, but still I am unable to find the upper and lower value of color. How to do i calculate that? I have to take out the pickachu from the image and this my code till now import cv2 import numpy as np cap = cv2.VideoCapture(0) while True: _, frame = cap.read() hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) lower_red = np.array([30,50,50]) upper_red = np.array([255,255,180]) #it is trial and error mask = cv2.inRange(frame, lower_red, upper_red) res = cv2.bitwise