Ask Your Question

mbroadbe's profile - activity

2020-09-17 11:54:03 -0600 received badge  Popular Question (source)
2017-07-05 19:31:04 -0600 commented question How to write the same image format, compression and dpi of the image I read in

sure, I understand rows and columns etc.

But I can't believe that someone hasn't wanted to write an image that would be a specific size, even if it was for printing.

2017-07-05 15:41:56 -0600 commented question How to write the same image format, compression and dpi of the image I read in

No not exactly. So the number of rows and columns does work out to be the same, but OpenCv drastically changes the pixel size... Maybe ultimately that's my question

So the original image has a pixel size of 0.0008, 0.0008, 8 bit, unsigned And the output pixel size is in one display 1,1

How do I enforce a specific output pixel size?

2017-07-04 19:23:26 -0600 asked a question How to write the same image format, compression and dpi of the image I read in

Hi,

I'm trying to read an uncompressed Tif, rotate it around a point that isn't the center of the image, crop it and write (ideally) to the same format, or at very least the same DPI. Rough code below.

I can get it to rotate and crop but on writing out the tif it results in a compressed format that messes with the next part of my script.

When I switched it to exporting a bmp or uncompressed png it seems ok, but the dpi is a 10th of the input and the dimensions are 10 times the size of the original image.

Initial image: 7.23inches, 9.15inches, 1200DPI
Output image: 76.38inches 97.3inches    111DPI

This creates a huge image that also screws up the next part of my script.

What do I do? I'm neither a python or OpenCv2 guru, so any help is appreciated with cv2 or if you have an alternative that also works. :) Happy Independence Day.

Cheers, Michael

image = cv2.imread(Path + str(inputline[0]) + ".tif")
#Use cv2.warpaffine to rotate
#Crop by taking image[y's, x's]
 cv2.imwrite(Path + inputline[0] + ".tif", crop_img)
2017-05-01 20:40:22 -0600 asked a question Open CV install Error - Numpy version incorrect

Hi,

I tried to get Open CV up and running, but when I run importCV I get the following error

import cv2 RuntimeError: module compiled against API version 0xa but this version of numpy is 0x7

I'd followed the path to installing numpy so just picked up whichever version that was. Does Open CV work with a particular Numpy version, wasn't sure what Oxa stood for.

I'm using Windows 10 if that adds any complications to it either.

Cheers, Michael