• Post Reply Bookmark Topic Watch Topic
  • New Topic

BufferedImageOp

 
Christopher Arthur
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm trying to use the ConvolveOp and RescaleOp on a jpeg, and i get exceptions. I fished around on the web and found a log of someone having the same problem, claiming that he had to convert images from Type 5 to Type 1 in order to use some of the image processing classes. But, he didn't say how he did this conversion...so I'm wondering if anyone has any ideas.

chris
 
Christopher Arthur
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I solved my own problem by doing a little bit more research. Apparently you can use ConvertColorOp to convert to different image types. You just have to define first an empty destination image of the type you want, and the convert class does the rest.

Now I have another problem, using ConvolveOp. I want to use a kernel that detects horizontal value changes, so I should use a matrix like this:

0 0 0
-1 0 1
0 0 0

In a purely mathematical context, the results of such a convolution will in general produce an array with both positive and negative values. Negative would signify an increase from left to right, and positive a decrease from left to right.
In a bitmap image context it doesn't make sense to think about negative color, so I think that ConvolveOp probably takes the absolute value of the convolution. This is not good for my purposes because I want to construct a gradient field that shows the directions of value changes.
If I want to be able to use the nice classes and methods of the 2D API, I'm wondering now if I can define a custom image type that supports negative values. I won't try to display an image like this, so I think it should work if I can figure out how to define sample models & color models. I'm only working with gray scale images anyway.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!