brianchirls / Seriously.js

A real-time, node-based video effects compositor for the web built with HTML5, Javascript and WebGL
MIT License
3.87k stars 354 forks source link

Issue with rendered canvas when using chromakey effect #167

Open ghost opened 6 years ago

ghost commented 6 years ago

I've been digging through the old questions on this trying to find a solution.

I did stumble upon this issue which recommended using reformat - example

But I'm struggling to get the rendered video to be 100% width / height whilst attempting this solution.

Below is my code.

var video;
var canvas;
var reformat;

function setup() {
  canvas = createCanvas(windowWidth, windowHeight, WEBGL);
  canvas.id('p5canvas');
  video = createCapture(VIDEO);
  video.size(620, 480);
  video.id('p5video');
  video.hide();

  reformat = createCanvas(windowWidth, windowHeight, WEBGL);
  reformat.id('reformat');

  var seriously = new Seriously();

  var src = seriously.source('#p5video');
  var target = seriously.target('#p5canvas');
  var reformat = seriously.transform("reformat");

  var chroma = seriously.effect('chroma');
  chroma.source = src;
  target.source = chroma;
  var r = 255 / 255;
  var g = 255 / 255;
  var b = 255 / 255;
  chroma.screen = [r,g,b,1];

  reformat.width = target.width;
  reformat.height = target.height;
  reformat.mode = 'cover';

  reformat.source = '#p5canvas';
  target.source = '#reformat';

  seriously.go();
}
ghost commented 6 years ago

I've also attempted targeting a canvas element in the DOM - but the rendered capture still seems to not fill the canvas element

calleufuzi commented 4 years ago

Hi! I had a same problem and with reformat solved my problem.

calleufuzi commented 4 years ago

try this

Captura de Tela 2020-03-30 às 02 43 14

try this! I hope this help you

Headstock67 commented 3 years ago

@calleufuzi

Super job!