Is the 'IPCapture' library not usable? (not Android mode?)

For the IPCapture library,

Is the ‘IPCapture’ library not usable?

[User environment]

Is there any way to view IP camera images using ‘IPCapture’?

Hi,

If you don’t provide your code, we can’t help you.
To do that, just press Ctrl+T int the Processing IDE and use the </> button in the message editor on the forum.

import ipcapture.*;

IPCapture cam;

void setup() {
  size(320,240);
  cam = new IPCapture(this, "http://192.168.0.12:8080" , "admin", "admin" );
  cam.start();
 
}

void draw() {
  if (cam.isAvailable()) {
    cam.read();
    image(cam,0,0);
  }
}

void keyPressed() {
  if (key == ' ') {
    if (cam.isAlive()) cam.stop();
    else cam.start();
  }
}

@josephh

Common source code shown in the example.

Is your camera connected to the network?. Can you access it with your computer? Does the port 8080 is open?

If you are on linux, you can try :

nmap 192.168.0.12

To scan all the ports of your camera.

ifconfig

To check if you are on the same network with your camera.

http://192.168.0.12:8080/web/index.html

The port address is obvious.

If your code is exaclty the example of the library IPCapture, then maybe it has something to do with the :

"admin", "admin"

@GWAK ===
Though this library was not upated since 4 or 5 years it seems to work; i have tried it with a public IP camera without user name or password && i got the images; so i think that your problem is not here.
PS: the test example does not work, the url is dead.

import ipcapture.*;

IPCapture cam;

void setup() {

size(1000,500);
cam = new IPCapture(this, “http://”+“192.168.0.110/Streaming/Channels/2/preview?openalprfiletype=file.mjpg”, “admin”, “aa852!”);
cam.start();

delay(1000);
}

void draw() {
if (cam.isAvailable()) {
cam.read();
image(cam,0,0);
}
}

void keyPressed() {

}

@akenaton
@josephh

Thank you for your interest.

As above, it works in JAVA mode
It does not work in Android mode.

Why?
Do you know the answer?

  • Android mode 3.0.1 (Processing tool)
  • SDK: API6.0 / 7.0 / 8.1 → not action
  • Smart Phone: 6.0 / 8.1 → not action

@GWAK === as you an see there is an error but i cannot read it: cut && copy.

@akenaton

The above photo debug content is as follows.

debug:
(HTTPLog)-Static: isSBSettingEnabled false
(HTTPLog)-Static: isSBSettingEnabled false
(HTTPLog)-Static: isSBSettingEnabled false
(HTTPLog)-Static: isSBSettingEnabled false
Frame resize: from 1000x500 to 640x360
FATAL EXCEPTION: Animation Thread
Process: processing.test.ipcapturetest, PID: 8894
java.lang.NoSuchMethodError: No virtual method init(IIII)V in class Lprocessing/core/PImage; or its super classes (declaration of ‘processing.core.PImage’ appears in /data/app/processing.test.ipcapturetest-2/base.apk)
at ipcapture.FrameBuffer.toPImage(Unknown Source)
at ipcapture.IPCapture.read(Unknown Source)
at processing.test.ipcapturetest.IPCaptureTest.draw(IPCaptureTest.java:46)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PGraphicsAndroid2D.requestDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:818)

@GWAK ===
ok; try to set your size (in setup) to 640X360

1 Like

@akenaton

Dear akenaton,

As you say, you can do it with a smaller size.
You are a genius. Thanks for your kindness.

But what I want is
fullScreen ();
On the full screen screen,
I want to make the CCTV screen as big as possible.

Do you have a way(solution)?

@GWAK ===
it s not with a “smaller size” it s with the same size than the cam in order to avoid the error you got which is related to “frame resize()” - So if your image from the cam is bigger that is not a problem, you have only (i guess, not tested) to adapt size() to it.

1 Like

@akenaton

Thank you for your kind reply.

However, the conclusion is that it does not raise the image screen.
(Not action)
I’m so sad.
I hope you find a way.

@GWAK===
not sure to understand
post a picture of what you (ideally) want to get
knowing that your phone has probably a very higher res than your cam
&& that it is probably not homothetic to your cam images

@akenaton

Dear akenaton
Corrected by correcting the library.
Processing was a conflict between Android mode and IPcature library. It works well because it solves it.
Thank you very much for your help.

Existing code: img.init(w, h, PImage.RGB,1);
Modification code: img.init(w, h, PImage.RGB);

Thanks.~

3 Likes

I’ve modified the IPCapture library as you suggested.
Now, the image resizes but only the first one, then the image freezes and, eventhough the console says it keeps resizing images, they are not shown.
This is the code I have:

 IPCapture cam;

 void setup() {
   fullScreen();
   cam = new IPCapture(this, "http://"+R2B2ip+"/?action=stream", "", "");
   cam.start();
 }
 
 void draw() {
   if (cam.isAvailable()) {
     cam.read();
     cam.resize(displayWidth,displayHeight); 
     image(cam, 0, 0);
   }
   else{
     print("fail");
   }
 }

@GWAK Do you remember if you did something different? Maybe you still have the code? I’ve been trying to solve this problem for days and I am getting desperate. Thank you so much!

1 Like

The fourth parameter in the init void of the PImage Class should be used I think. I do not understand this.
@akenaton can you explain this?

init
public void init(int width,
                 int height,
                 int format,
                 int factor)
Function to be used by subclasses of PImage 
to init later than at the constructor,
or re-init later when things changes. 
Used by Capture and Movie classes (and perhaps others), 
because the width/height will not be known when super() is called.
 (Leave this public so that other libraries can do the same.)
1 Like

@Veci

This is a problem when you are in Android mode.
If you do not have a PC.

@technew maybe you can help?