Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image processing 将p5.js映像发送到服务器_Image Processing_Server_P5.js - Fatal编程技术网

Image processing 将p5.js映像发送到服务器

Image processing 将p5.js映像发送到服务器,image-processing,server,p5.js,Image Processing,Server,P5.js,我通过网络摄像头从createcapture()捕获了一幅图像。使用image(),我将图像放到画布上。使用saveframes(),以及回调,我能够将图像发送到服务器,但是图像大小非常大,我希望图像每次都是100 x 100像素,无论saveframes()中的图像大小如何,然后再发送到服务器 var x = window.innerWidth * 0.5; var y = window.innerHeight * 0.75; function setup() { cnv = crea

我通过网络摄像头从
createcapture()
捕获了一幅图像。使用
image()
,我将图像放到画布上。使用
saveframes()
,以及回调,我能够将图像发送到服务器,但是图像大小非常大,我希望图像每次都是
100 x 100
像素,无论
saveframes()
中的图像大小如何,然后再发送到服务器

var x = window.innerWidth * 0.5;
var y = window.innerHeight * 0.75;
function setup()
{
    cnv = createCanvas(x, y);
    videoInput = createCapture(VIDEO);
    videoInput.size(x, y);
    videoInput.hide();
}
function draw()
{
    if (videoInput) {
        image(videoInput, 0, 0, x, y);
    }
} 

function image()
{
    saveFrames('out','png',1,1,
        function(im) {
            console.log(im);
            console.log(typeof im[0]);
            // image Data is stored in im[0].imageData
            // convert the image to smaller size
            data.imageData = im[0].imageData;
            // data.imageData = Math.random();
        }
    );
    $.post('addname',data,function(result) {
        console.log("data sent", result);
    });
}

为什么不在将图像发送到服务器之前调整图像大小?是的。我想在发送到服务器之前调整图像大小。但是如何调整??