質問

I am trying to process a credit card image using GPUImage library to read its number. As I wanted to read the black text number, wanted to ask whether it's possible to convert colors except black into white color?

役に立ちましたか?

解決

You're looking for a thresholding operation. There are several varieties of these in GPUImage:

  • GPUImageLuminanceThresholdFilter: Does a threshold based on the luminance of each pixel, with the pixel turning to white if it's above a certain luminance value and black if below that.
  • GPUImageAdaptiveThresholdFilter: Does a threshold based on the averaged region around a pixel, with a pixel turning white if it has a higher luminance than the average and black if a lower luminance.
  • GPUImageAverageLuminanceThresholdFilter: Does a threshold based on the total average luminance of the image. Usually, the Mac and iOS cameras tend to center themselves around an average luminance of 0.5, so this generally doesn't produce results significantly different than the GPUImageLuminanceThresholdFilter, and tends to be much slower.

You should just need to choose between one of these for what works best in your particular application.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top