bytedeco/javacv

Android Camera Filter using JavaCV

Open

#332 opened on Feb 16, 2016

View on GitHub
 (1 comment) (0 reactions) (0 assignees)Java (1,583 forks)batch import
help wantedquestion

Repository metrics

Stars
 (6,985 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Hi I'm Newbie, I found a custom android camera app which using JavaCV(https://github.com/sourab-sharma/TouchToRecord). I want add filter string command into RecorderThread.java class in this app. I added string command with colorchannelmixer param into FFmpegFrameFilter string command as:

  1. String cropVideo = "crop=w=" + Config.CAMERA_CONSTANTS.OUTPUT_WIDTH + ":h=" + Config.CAMERA_CONSTANTS.OUTPUT_HEIGHT + ":x=" + 0 + ":y=" + 0;
  2. String rotateVideoFrontCam = "transpose=cclock,hflip,colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131," + cropVideo;
  3. String rotateVideoBackCam = "transpose=clock,colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131," + cropVideo; String cropVideoFrontCam = "hflip,colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131," + cropVideo;
  4. filterRotateVideoFrontCam = new FFmpegFrameFilter(rotateVideoFrontCam, previewWidth, previewHeight);
  5. filterRotateVideoFrontCam.setPixelFormat(avutil.AV_PIX_FMT_NV21);

But, I do not understand colorchannelmixer params and FFmpeg homepage have 2 example:

  1. Convert source to grayscale: colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  2. Simulate sepia tones: colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131

I have 2 question:

  • How exactly to add params to colorchannelmixer params and change them?
  • Have other solution for resolv this problem?

Thank so much!

Contributor guide