Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8639503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:01:21+00:00 2026-06-12T11:01:21+00:00

What I am trying to do is to convert a pixel from a video

  • 0

What I am trying to do is to convert a pixel from a video cam, into an image
to expalin it better imagine a 3d model so.. the pixels would be each polying, and i want to do is to conver each polyigon into an image.

What i have so far is this:

**
import processing.video.*;
PImage hoja;
Capture cam;
boolean uno, dos, tres, cuatro;


import ddf.minim.*;

Minim minim;
AudioPlayer audio;
float set;



void setup() {

  //audio
  minim = new Minim(this);
 // audio = minim.loadFile("audio");
 // audio.loop();

//  
  uno=false;
  dos=false;
  tres=false;
  cuatro=true;
  size(640, 480);
  hoja=loadImage("hoja.gif");


    cam = new Capture(this, width, height);
    cam.start();

}

void draw() {
  if (cam.available() == true) {
    cam.read();

    if (uno==true) {
      filtroUno();
       image(cam, 0, 0, 640, 480);
       }
          if (dos==true) {
        filtroDos();
      }

      if(tres==true){
      filtroTres();
      }

      if(cuatro==true){
        filtroCuatro();
        image(cam, set, 0,640,480);
      }
  }


  // The following does the same, and is faster when just drawing the image
  // without any additional resizing, transformations, or tint.
  //set(0, 0, cam);
}

void filtroUno() {
  cam.loadPixels();
  hoja.loadPixels();
  for (int i=0;i<cam.pixels.length;i++) {
    if (brightness(cam.pixels[i])>110) {
      cam.pixels[i]=color(0, 255, 255);
    }
    else {
      cam.pixels[i]=color(255, 0, 0);
    }
  }

   for (int i=0;i<cam.width;i+=10) {

    for (int j=0;j<cam.height;j+=10) {
      int loc=i+(j*cam.width);
      if (cam.pixels[loc]==color(255, 0, 0)) {
        for (int x=i;x<i+10;x++) {
          for (int y=j;y<j+10;y++) {
            //  println("bla");
            int locDos=i+(j*cam.width);
            cam.pixels[locDos]=hoja.get(x, y);
          }
        }
      }
    }
  }

  cam.updatePixels();
}
**

The problem is that each pixel is creating me a matrix, so.. is not recreating what id that to do.

I had the method filtroUno but it wasn’t showing ok..
and was the result

void filtroUno() {
  cam.loadPixels();
  hoja.loadPixels();
  for (int i=0;i<cam.pixels.length;i++) {
    if (brightness(cam.pixels[i])>110) {
      cam.pixels[i]=color(0, 255, 255);
    }
    else {
      cam.pixels[i]=color(255, 0, 0);
    }
  }

  for (int i=0;i<cam.width;i+=10) {

    for (int j=0;j<cam.height;j+=10) {
      int loc=i+j*hoja.width*10;
      if (cam.pixels[loc]==color(255, 0, 0)) {
        for (int x=i;x<i+10;x++) {
          for (int y=j;y<j+10;y++) {
            //  println("bla");
            int locDos=x+y*hoja.height*10;
            cam.pixels[locDos]=hoja.get(x, y);
          }
        }
      }
    }
  }

  cam.updatePixels();
} 

enter image description here

i hope you can help me thanks

note: each red pixel should be the gif image the imge size is 10×10

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T11:01:22+00:00Added an answer on June 12, 2026 at 11:01 am

    I think what you are doing is looping through every 10th pixel in a webcam image and if the pixel is red you are placing the contents of a 10x10px gif over the webcam image with the top left corner of the gif positioned at the pixel that was red.

    // loop through each 10th column in the camera
    for (int i=0;i<cam.width;i+=10) {
    
        // loop through each 10th row in the camera
        for (int j=0;j<cam.height;j+=10) {            
    
            // calculate the pixel location at (i, j)
            int loc=i+(j*cam.width);
    
            // check the pixel is red
            if (cam.pixels[loc]==color(255, 0, 0)) {
    
                // loop through each column in the gif image
                for (int x=0;x<10;x++) {
    
                    // loop through each row in the gif image
                    for (int y=0;y<10;y++) {
    
                        int locDos = (i + x) + ((j + y) * cam.width);
                        cam.pixels[locDos]=hoja.get(x, y);
                    }
                }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying convert all special chars into HTML safe entities on their way into
Trying to convert a string of binary inputs into a vector of ints. I'd
Trying to convert output from a rest_client GET to the characters that are represented
Trying to convert this c code into MIPS and run it in SPIM. int
im trying to convert a date format into a new format in this example
I have been trying to figure out a way to convert bitmap files into
I'm trying to resize an image while preserving the aspect ratio from the original
How to extract and save array from string parameter? I'm trying convert string beafore_create
I want to read the RGB values for each pixel from a .bmp file,
I've been trying to convert this JavaScript code that gets the dominant color from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.