0

I am trying to detect if an image is blurry, in ColdFusion, but I am kinda' stuck. I read Is there a way to detect if an image is blurry? , but these coding examples are unusable in ColdFusion. If required, I can use ImageMagick.

In total, I need to process about 1 million images a month which are uploaded by users. Speed is very important.

Community
  • 1
  • 1
Nebu
  • 1,753
  • 1
  • 17
  • 33
  • 1
    _"these coding examples are unusable in coldfusion"_ - why do you say that? There's a [Java API](http://docs.opencv.org/java/) for OpenCV, which can be used from CF. – Peter Boughton Mar 03 '14 at 14:20
  • I cannot add java libraries to our server. – Nebu Mar 03 '14 at 14:34
  • 3
    Do you mean you can't add them to the class path? If so, you can probably load them with Javaloader https://github.com/markmandel/JavaLoader – Sean Coyne Mar 03 '14 at 14:44
  • I can indeed load the class from the javaloader but this seems a bit overkill for processing many images. – Nebu Mar 03 '14 at 15:38
  • 5
    You have a million images to process a month and speed is "very important". WTF makes using a dedicated image processing tool overkill?! – Peter Boughton Mar 03 '14 at 15:52
  • 1
    Made an error. Thought i had to load the class via the javaloader for each image, but i can off course save the class in the session or application scope. – Nebu Mar 03 '14 at 16:10
  • Ah, yes, you definitely want to do that. – Peter Boughton Mar 03 '14 at 16:12
  • BTW, if you are using CF10 it has a rip of [Mark Mandel's JavaLoader](https://github.com/markmandel/JavaLoader) already [built in](http://help.adobe.com/en_US/ColdFusion/10.0/Developing/WSe61e35da8d318518-106e125d1353e804331-7ffe.html). – Leigh Mar 04 '14 at 15:24

1 Answers1

7

There are about 2.5 million seconds in a month, so you've got 2.5 seconds to play with per image, assuming you're processing them in a batch. If you expect an instant response for users then 2.5 seconds probably isn't close to ok.

CF is good at plenty, but applying a FFT on images of arbitrary size isn't in its sweet spot. You'll need to use another library. As @Sean_Coyne says, JavaLoader can help there.

I would also challenge whoever says you can't add extra libraries. If you're processing a million images a month, you're going to need an extra library and that's not unreasonable.

I'd also say that you need to profile the application to see what the CPU and memory requirements are like during your busiest expected period.

If you do go with OpenCV, bear in mind that although it has Java bindings, it runs native code, so you shouldn't rely on the memory stats that Java's GC logging give you (use your OS's process monitoring instead) and bear in mind that you'll need the appropriate version for your developer and production OSes.

barnyr
  • 5,678
  • 21
  • 28