Faster RGB to Grey conversion Python. [closed]

asked 2016-03-26 11:48:06 -0600

Shahrukh Q gravatar image

I am using "cv2.cvtColor(rgb_image, cv2.COLOR_BGR2GRAY)" to convert grey it is taking 0.801 seconds to convert. I am developing a real-time application where I convert RGB image to grey and perform operation but it is slow. Is there any faster way to convert.

Thanks.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2020-10-04 02:50:27.718576

Comments

1
  • please show us, how you measure that
  • no, there is no faster alternative. on what machine is that running on ?
  • did you compile your own cv2.pyd ? did you enableble any optimizations (tbb/icp/ocl) ?
berak gravatar imageberak ( 2016-03-26 12:03:15 -0600 )edit

I just print time before and after this function. I am using windows, intel i5 processor. I did not enabled any optimization. And I did not complie. @berak

Shahrukh Q gravatar imageShahrukh Q ( 2016-03-26 12:10:22 -0600 )edit

How big is your image?

FooBar gravatar imageFooBar ( 2016-03-26 14:33:42 -0600 )edit

@FooBar 720X576

Shahrukh Q gravatar imageShahrukh Q ( 2016-03-26 14:36:30 -0600 )edit

And which hardware are you using? How does you code look like?

FooBar gravatar imageFooBar ( 2016-03-27 12:34:30 -0600 )edit

@FooBar Lenove thinkpad.

image = cv2.imread(path)

start_time = datetime.now()

grey = cv2.cvtcolor(image, cv2.COLORBRG2GREY)

end_time = date time.now() print((end_time-star t_time).total_seconds())

Shahrukh Q gravatar imageShahrukh Q ( 2016-03-27 15:39:12 -0600 )edit
1

^^ 12 typos in 5 lines, yikes !

berak gravatar imageberak ( 2016-03-28 02:02:23 -0600 )edit