Ask Your Question

syang2100's profile - activity

2020-01-03 04:04:49 -0600 received badge  Notable Question (source)
2019-04-14 07:57:44 -0600 received badge  Popular Question (source)
2014-04-12 02:12:54 -0600 asked a question How to convert image format from "crw/raw" to "tiff" format in OpenCV?

Hi, I have Canon DSLR. Its highest resolution with uncompressed image file is ".crw" or raw image file. Is there a way to convert ".crw" to ".tiff"? Thanks.

2014-04-07 03:00:04 -0600 received badge  Self-Learner (source)
2014-04-06 18:23:23 -0600 asked a question Does python 2.7.5 support long file path?

Hi,

My OS is windows 7 with Python 2.7.5. I try to open and write data to HD. But, my python seems cannot handle long file path. For example, (1) does not work, but (2) does work. Do I do something wrong or it just the limitation of python for Windows? Thanks.

f = open('C:\Users\Sa\Documents\01_Project\myfile_Test.txt','w') #(1)

f = open('myfile_Test.txt','w') #(2)

2014-04-06 16:33:01 -0600 commented question Image conversion problem in python and OpenCV

Hi break. Thank you for your help. I found solution now. I was confused by the image's data type from example code. Thanks.

2014-04-06 16:30:52 -0600 answered a question Image conversion problem in python and OpenCV

Hi All,

After days struggle, I found the solution for this problem. Just remove (1), (2), (3), and add (4), shown below. I have data type conflict with the example provided in the internet. Now, the problem is resolved. Thank you for your help.

cv2.imwrite("C:\Users\Sa\Pictures\clip_35.jpg",clip_8bit) #(1), write as gray scale image

clip_8bit = cv2.imread("C:\Users\Sa\Pictures\clip_35.jpg") #(2), read as color image

imgray = cv2.cvtColor(clip_8bit,cv2.COLOR_BGR2GRAY) #(3), transfer to gray scale again

imgray = clip_8bit #(4)

2014-04-06 02:31:33 -0600 commented question Image conversion problem in python and OpenCV

Yes. I want to get rid of the save/readback mechanism. The original image is grayscale but within ROI. When I try to "findContours", it does not work. It work only after I use the save/readback mechanism. Is there a quick way to transfer image in ROI to a individual image?

2014-04-04 01:33:36 -0600 commented question Image conversion problem in python and OpenCV

It does not work. Is that possible something to do with "clip_8bit=img_8bit[200:250,200:250]"? After imwrite and imread, it is no longer an ROI. It is an complete image. I guess. If so, is there is a way to copy/clone an ROI image to a image varaiable. .

2014-04-03 02:12:18 -0600 received badge  Editor (source)
2014-04-03 02:10:20 -0600 asked a question Image conversion problem in python and OpenCV

Hi,

Below scrip work, but it is kind of stupid. I need to write and read file from HD in order to make it work. Is that possible to remove imwrite() and imread() from the middle of script. I think it is about image format issue, but I do not know how to fix it. Can any advanced expert show me a hint to fix this problem please? Thanks.

!/usr/bin/python

import cv2.cv as cv

import cv2

import numpy as np

img_8bit = cv2.imread("C:\Users\Public\Pictures\Sample Pictures\Penguins.jpg",0)

clip_8bit=img_8bit[200:250,200:250]

# Below two lines write image and read it from HD.  
cv2.imwrite("C:\Users\Sa\Pictures\clip_35.jpg",clip_8bit) 

clip_8bit = cv2.imread("C:\Users\Sa\Pictures\clip_35.jpg")
#Is there a better way to convert file format and replace above two lines?

imgray = cv2.cvtColor(clip_8bit,cv2.COLOR_BGR2GRAY)

ret,thresh = cv2.threshold(imgray,127,255,0)

contours, hierarchy = cv2.findContours(thresh,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)

BeadCount=hierarchy.shape[1]+1
2014-04-02 02:02:52 -0600 commented question imread() vs LoadImage() in Python

My code was: import cv2.cv as cv im = cv.imread("lean.jpg",1) Using wrong libery was the source of the problem. I got it now. Thanks.

2014-04-02 01:58:31 -0600 commented question imread() vs LoadImage() in Python

It is new to me. Maybe I should focus on V2 code. Thanks.

2014-04-02 01:36:47 -0600 asked a question imread() vs LoadImage() in Python

Hi,

I am a new user to Python with OpenCV (1 week old). When I search for code for some specific function, but many of them does NOT work for me. For example, I found a command to load image, I found many example with imread() command, but, my Python only work with LoadImage(). It is really confuse me because it happen on other command too. If I wish to use imread() in Python, how can I make it work?

Is that version problem? What could be wrong with my setup? I appreciate it if anyone can help me. Thanks.

Version:

Python: 2.7.3, OpenCV: 2.4.3, numpy: 1.6.2, OS: MS-Windows 7

Below two command are fro Python:

Python: cv2.imread(filename[, flags]) → retval

Python: cv.LoadImage(filename, iscolor=CV_LOAD_IMAGE_COLOR) → None

Found from: http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html