Axis Network Camera Jpeg mess

I am trying to read the MJPGs from an Axis camera. I can get each image as a bufferedimage, but I need to also get them as a byte[] buffer. I need to pass on that byte[] buffer to other listeners. I am having a fun time trying to convert the image to a byte buffer. I have tried several examples found here and elsewhere and nothing seems to work when I try to convert the byte[] buffer back to an image via           thepic = tk.createImage(myBytebuff[]);
any assistance is appreciated!
Greg

When you talk about turning an image into a byte[] buffer you need to be specific about how data is formatted
in that buffer -- there are plenty of ways to do it.
Nevertheless, here is a demo where I create a series of buffered images:
1. The source image, as read.
2. intImage, which holds its data in an int[],
3. byteImage, which holds its data in a byte[]
Then I extract a byte array from byteImage and demonstrate that I can recover the image by creating
4. recovered, which is created from a databank byte[].
You should take your image and convert it to have a byte[] databank, if needed, then see if that byte[]
is the correct format for your needs.
import java.awt.*;
import java.awt.color.*;
import java.awt.image.*;
import java.io.*;
import java.net.*;
import javax.imageio.*;
import javax.swing.*;
public class BufferedImageToByteArray {
    public static void main(String[] args) throws IOException {
        URL url = new URL("http://today.java.net/jag/bio/JagHeadshot-small.jpg");
        BufferedImage source = ImageIO.read(url);
        BufferedImage intImage = convertType(source, BufferedImage.TYPE_INT_RGB);
        BufferedImage byteImage = convertType(source, BufferedImage.TYPE_3BYTE_BGR);
        byte[] data = getData(byteImage);
        BufferedImage recovered = toImage(data, source.getWidth(), source.getHeight());
        JPanel cp = new JPanel(new GridLayout(2,2));
        addImage(cp, source, "Source Image");
        addImage(cp, intImage, "TYPE_INT_RGB Image");
        addImage(cp, byteImage, "TYPE_3BYTE_BGR Image");
        addImage(cp, recovered, "Recovered Image");
        JFrame f = new JFrame("BufferedImageToByteArray");
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setContentPane(cp);
        f.pack();
        f.setLocationRelativeTo(null);
        f.setVisible(true);
    static void addImage(Container cp, BufferedImage im, String title) {
        JLabel label = new JLabel(new ImageIcon(im));
        label.setBorder(BorderFactory.createTitledBorder(title));
        cp.add(label);
    public static BufferedImage convertType(BufferedImage source, int type) {
        if (source.getType() == type)
            return source;
        BufferedImage result = new BufferedImage(source.getWidth(), source.getHeight(), type);
        Graphics2D g = result.createGraphics();
        g.drawRenderedImage(source, null);
        g.dispose();
        return result;
    public static byte[] getData(BufferedImage image) {
        return ((DataBufferByte)(image.getRaster().getDataBuffer())).getData();
    public static BufferedImage toImage(byte[] data, int w, int h) {
        DataBuffer db = new DataBufferByte(data, data.length);
        WritableRaster raster = Raster.createInterleavedRaster(db,
            w, h, 3*w, 3, new int[]{2,1,0}, null);
        ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
        ColorModel cm = new ComponentColorModel(cs,
            false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
        return new BufferedImage(cm, raster, false, null);

Similar Messages

  • LabView and Axis network camera

    Hello,
    I am using LabView 7 to display/save images from two network cameras
    (AXIS PTZ 2130). I use the ActiveX controls provided by Axis.
    It works, but the development is painful because the Methods and
    ActiveX controls are not well documented by Axis.
    Does anyone have some experience in it ?
    I am currently using the IAxisCameraControl class to control the camera motion,
    but I am also interested in managing the events
    ("OnNewImage"...) provided by the CamImageEvents class.
    Thanks!

    IAxisCameraControl Class?
    I found just IAxisMediaControl class...
    How can i have CameraControlClass? or is it the same?
    Kolos 

  • AXIS 213 Camera

    I have looked at several posts on the board regarding capturing an image from a webcam using labview and activex.  I am trying to do the same with an AXIS 213 PTZ Network Camera.  I am not having any luck so far as I do not have any experience in building dlls to hold the activex object, and I am not sure where to find the activex object to put into the dll.  If anyone has any experience with doing this especially if it was with an AXIS Network Camera then I would greatly appreciate any help or possibly an example vi if possible.
    Cheers!
    CLA, CLED, CTD,CPI, LabVIEW Champion
    Platinum Alliance Partner
    Senior Engineer
    Using LV 2013, 2012
    Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.

    Hello,
    I have downloaded the driver software and am looking over ActiveX examples but am still not clear on how to actually put a vi together that will call activeX methods that will allow me to interact with my device.  Am I correct that I need to have, in this case, the AXIS Video Capture Driver installed on my machine and know what methods the driver users in order to call these same methods within LabVIEW?  If this is true then I have to somehow create a dll that will point towards the AXIS Video Capture Driver to use its activeX methods?  As I mentioned this is new territory for me so I apologize if my questions are nonsense.  Any help will be appreciated!
    Cheers!
    CLA, CLED, CTD,CPI, LabVIEW Champion
    Platinum Alliance Partner
    Senior Engineer
    Using LV 2013, 2012
    Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.

  • How do I grab an image (Jpeg) of a Network camera?

    There was a question 3 years ago, which remained unanswered: How do I
    grab an image(JPEG) from the Web(http://) using the datasocket in
    LabView?(http://forums.ni.com/ni/board/message?boa​rd.id=200&message.id=847)
    I have the same problem. I would like to capture the image of an AXIS
    2006 wireless Network Cam with Labview, for further processing. A
    sample image with such a cam is available at:
    http://stareat.it.helsinki.fi/jpg/image.jpg

    If you just want a URL, you can use this example, which someone posted a while back.
    Try to take over the world!
    Attachments:
    Image from web.llb ‏78 KB

  • Communicating with an Axis 205 network camera

    Need to create a simple application so that I can contact my network camera. I have the API provided by Axis Communications. The camera supports HTTP 1.0, and the specific syntax for requesting an image is : "http://myserver/jpg/image.jpg". Need to request the image from Java, storing it before converting it to RGB.
    Any ideas?

    You'll need to install the Java Media Framework (JMF) and register a custom plugin to handle the HTTP-based MJPEG stream from these cameras. I've written a library that uses the Axis API v1.1, but I'm not sure if it will work with your specific camera since you don't list a model number.
    Check it out here:
    http://jipcam.sourceforge.net
    jipCam provides a Java Media Framework based datasource to read from different Internet Protocol based video cameras. A computer with Java, and the Java Media Framework, can install jipCam as a JMF protocol handler to allow an IP-based camera's video to become available for processing in JMF. This library is intended for use by developers seeking to build applications using IP-based video cameras on a Java platform.
    You guys can use this library to integrate the MJPEG stream from the Axis camera with JMF to get the camera images as Buffer objects in JMF. There are numerous examples in the source code.
    best luck,
    Jason Thrasher

  • Axis 2100 Network Camera

    It has dealt no with network camera Axis 2100?
    I am complicated with activex.

    If I understand you correctly, you would like to acquire IMAQ Images from a network camera that has an ActiveX control. This is possible if the control outputs images as 2D arrays. If so, you can use the IMAQ ArrayToImage.vi to convert these 2D arrays into IMAQ Images. From there you can take advantage of our IMAQ Vision functions.
    Kyle V
    Applications Engineer
    National Instruments

  • Is there anyone who can recommend a network Camera that works with OS X10.9

    I just upgraded to Mavericks and love the OS.  I just updated my printer to an HP that is compatible with Macericks and it works wonderfully!  Now I am looking to add a network camera that allows multi camera viewing and can be viewed on my Iphone or Ipad or Macbook, etc.  Anyone have any thoughts or suggestions on what to try.  All the major brands that have high ratings are compatible with 10.6 or 10.7, but I see no mention of 10.9 - any suggestions would be great!

    For what it's worth, I purchased the Axis 207W. Indeed it worked with Safari via Bonjour.
    The setup took a while to figure out, but wasn't any more difficult than setting up a wireless router.
    With things set properly I can view the camera from anywhere on the Internet and get e-mails sent when motion is detected by the camera.
    All this and it works well with my Apple set up (laptops and Airports).

  • Network Camera

    Hello all -
    Was wondering if I could get some advice.
    I would like to make a network camera, that is currently connected to my LAN, available to the www.
    I have a static IP address from my broadband supplier - and have set up a domain name with an external ISP that points to my static IP.
    I am running DNS on my OS X Server and have made an entry so that the same domain name points to the fixed (internal) IP of my network camera (which is 10.0.1.5)
    Portforwarding is set up on my airport express (which sits between my ADSL Modem (in bridge mode) and my server, to redirect all requests on port 80 / 8080 to my OS X Server (which is at 10.0.1.2)
    Of course - as I imagine you have realised - this doesn't work from outside of my LAN. Requests get forwarded to my server - but stop there - and don't get passed onto the network camera.
    I have tried embedding the image from the webcam in a webpage hosted on the server. Again, this works from inside the LAN, but from outside - the local address of the network camera does not get inside my LAN.
    I have tried a redirect - but get the same issue.
    I could setup a specific port - but want to keep the URL simple - without the user having to add a port number to the end.
    Am I best off asking my broadband supplier for a second static IP address ? Happy to do that but keen to see if there is a better way first.
    Any help much appreciated.
    Thanks,
    Andrew

    Thanks Camelot
    Really appreciate your help.
    I did try the 'wrapper' solution - and it didn't work from outside the LAN (fine from inside the LAN, or outside with a VPN). Seems as if the remote users browser / machine is still looking for a private IP address - obviously without success. This surprised me as I thought it would work. I used an HTML page from the camera manufacturers website. Pasted below : (my camera IP is 10.0.1.5)
    Don't think I'm brave enough to get under the hood of Apache - will check to see how much a 2nd Static IP address will cost.
    Thanks again,
    Andrew
    <html>
    <head>
    <title>Title</title>
    </head>
    <body>
    <center>
    <!-- Cut from here to the end of image display comment -->
    <!-- Note: If you do not see a JavaScript below in the view source window you must -->
    <!-- first save the html file from your browser, then open the saved -->
    <!-- file in a text editor, for instance Notepad.-->
    <SCRIPT LANGUAGE="JavaScript">// Set the BaseURL to the url of your camera
    // Example: var BaseURL = "http://172.21.1.122/";
    // Since this file is located inside the unit itself, no base url is specified here
    var BaseURL = "http://10.0.1.5/";
    // DisplayWidth & DisplayHeight specifies the displayed width & Height of the image.
    // You may change these numbers, the effect will be a stretch or a shrink of the image
    var DisplayWidth = "320";
    var DisplayHeight = "240";
    // This is the filepath to the image generating file inside the camera itself
    var File = "axis-cgi/mjpg/video.cgi?resolution=320x240";
    // No changes required below this point
    var output = "";
    if ((navigator.appName == "Microsoft Internet Explorer") &&
    (navigator.platform != "MacPPC") && (navigator.platform != "Mac68k"))
    // If Internet Explorer for Windows then use ActiveX
    output = '<OBJECT ID="Player" width='
    output += DisplayWidth;
    output += ' height=';
    output += DisplayHeight;
    output += ' CLASSID="CLSID:745395C8-D0E1-4227-8586-624CA9A10A8D" ';
    output += 'CODEBASE="';
    output += BaseURL;
    output += 'activex/AMC.cab#version=2,0,21,0">';
    output += '<PARAM NAME="MediaURL" VALUE="';
    output += BaseURL;
    output += File + '">';
    output += '<param name="MediaType" value="mjpeg-unicast">';
    output += '<param name="ShowStatusBar" value="0">';
    output += '<param name="ShowToolbar" value="0">';
    output += '<param name="AutoStart" value="1">';
    output += '<param name="StretchToFit" value="1">';
    output += '<BR><B>Axis Media Control</B><BR>';
    output += 'The AXIS Media Control, which enables you ';
    output += 'to view live image streams in Microsoft Internet';
    output += ' Explorer, could not be registered on your computer.';
    output += '<BR></OBJECT>';
    } else {
    // If not IE for Windows use the browser itself to display
    theDate = new Date();
    output = '<IMG SRC="';
    output += BaseURL;
    output += File;
    output += '&dummy=' + theDate.getTime().toString(10);
    output += '" HEIGHT="';
    output += DisplayHeight;
    output += '" WIDTH="';
    output += DisplayWidth;
    output += '" ALT="Camera Image">';
    document.write(output);
    document.Player.ToolbarConfiguration = "play,snapshot,fullscreen"
    // document.Player.UIMode = "MDConfig";
    // document.Player.MotionConfigURL = "/axis-cgi/operator/param.cgi?ImageSource=0"
    // document.Player.MotionDataURL = "/axis-cgi/motion/motiondata.cgi";
    </SCRIPT>
    <!-- End of image display part -->
    </body>
    </html>

  • Network cameras struggle to update video

    I updated Safari to 6.0 a couple of nights ago...  I have four house security cameras (panasonic network cameras).  I have occasion to move one or more of them quite often so what I discovered tonight is very new, I am guessing since I updated Safari...  At first I thought the camera motor signals were messed up but now I've discovered the video update from any and all of the four cameras freezes often but only on Safari...  Firefox on the mac works fine and IE over on Windows 7 running under VMware Fusion works fine also...  In fact, I move a camera from Safari...  I see no change...  But I flip over and look at Firefox and the camera has clearly moved... 
    All the controls on Safari seem to be working fine including commanding the camera motors to move...  But it's the video feed from the camera to Safari that is messed up...  Any ideas why???  Is anyone else having similar problems with video cameras with the new version 6 of Safari???
    Also, I just upgraded to OS X 10.8 last night but since Firefox still works fine with these cameras, I would guess the issue was with the Safari upgrade that I need the night before I upgraded to 10.8...  Thoughts????
    thanks... bob...

    Thanks Jim, always appreciate your quick replies.
    I still need a little help.
    From the linked document, it would appear that the CPU is more likely to be the problem than the video card.  They speak of "video configuration."  What do the mean by that?
    On the other hand, the forum is full of discussion about video cards and the need for an appropriate one.
    One more question. When the video freezes on playback, if I wait for a minute or so, it restarts.  What is happening during this minute?  (Cleaning the cache doesn't change anything).
    Thanks again.

  • QT Streaming from Network Camera?

    Hi everyone!
    We were wondering if we could do QT streaming via network cameras? We purchased a few AXIS 206W network cameras. We realised that they only produce MJPEG movies. Is it possible to do QT streaming with these cameras? Could you recommend some tools/documentations regarding this issue? Thank you.
    Ning
      Mac OS X (10.4)  

    As your trial has proved the start/stall playback means you've reached the bandwidth limits of your device. Lots of reasons why.

  • Panasonic network cameras no longer work with new versions of Firefox.

    I have been viewing my Panasonic Network camera, model BB-HCM381A using Firefox for several years.
    Starting with Firefox version 15.0.1 and again with 16.0.1, 16.0.2 and 17.0.1 the browser begins to display the streaming video, but then drops the signal after maybe 20 seconds. Refreshing the page brings back the image for another 20 seconds, and then drops it again.
    All previous versions of Firefox before version 15.0.1 worked great. Now I have to use Internet Explorer exclusively. It would be great if you could fix the problem.
    Example of viewing the streaming video can be found at www.bandon.tv, which may require installing a plug-in from Panasonic.

    I see the same happen, but it takes longer. It is possible that the server gets too many visitors and drops some of them. A right click and "This Frame > Reload This Frame" also works. I also notice that frames get blocked (it skips seconds), so you may need a faster server.
    <!-- http://hithere.viewnetcam.com:50000/ImageViewer?Mode=Motion&Resolution=640x480&Quality=Clarity&Title=0 -->
    <!-- data:text/html;charset=utf-8,<input xmlns="http://www.w3.org/1999/xhtml" width="640" type="image" height="480" border="0" src="http://hithere.viewnetcam.com:50000/nphMotionJpeg?Resolution=640x480&amp;Quality=Clarity" name="NewPosition" /> -->

  • Video Streaming from a network camera!

    Hi,
    Does anybody have an idea how to go about streaming video from a network camera using applets? I know its possible in JMF, but I was wondering if its possible without that because I guess it needs the user to install JMF. Or a way with JMF but total platform independent?
    PLZ.

    i am not sure about the archive stuff neither am i very good at java. I am just a trainee here and wa given this task. so I went up searching on google, found these sites and then when I wasnt able to run the applet, I researched about running jmf applet. the setting classpath and stuff is given in the jmf website and even an aaplet which tests if jmf is installed on your system. I was just trying to act as one of the users trying to run the application. i was just trying to find an easier way out but guess there isn't.
    now if anybody of you would know how go about getting a video steam from the IP camera using JMF?

  • Network camera access via airport extreme ie: i need to assign a port and a

    please help me i have a cabin in the mountains that is off the grid... and i use solar power... i have my internet access via wifi and an antenna... it goes to a d-link router in my electric room then from there via a cat 5 cable to a apple airport extreme base station... and i would like to plug the camera into the base station via a cat 5 cable....
    i am trying to set up a network camera to via a airport extreme base station.... the tech support on the camera end (airlink 101 skyIP cam500 model aicn500) said to enable port 80 and to assign a IP address (which i have)... apple support has been unable to help me after almost 1 hour with tech support.... here is what the camera tech support page suggests....
    You will now need to forward the Second HTTP Port through your router to the IP address of the camera. If you have an AirLink101 router, we have instructions in our knowledge base for port forwarding. If you have a router from another company, you will need to contact them for instructions on port forwarding.
    When accessing the camera from a remote location you will need to open a browser and type in the internet IP address of your network (not the ip address of the camera) and the port into a web browser. The address and port will need to be typed in like this:
    http://x.x.x.x:port
    x.x.x.x = Internet IP address
    port = Second HTTP Port
    Here is an example of what it would look like: http://123.123.123.123:81
    can anyone please help me?

    i can not thank you enough for taking the time time to help me!!! i really appreciate it.... i have done the set up with the d link router and am now trying to access the camera from the web.... but i am having trouble logging in and finding it? i am not sure what ip address to enter into my web browser? i think that i need to add the ip addresss folllowed by a forward slash and then the port # 80.... but what ip address should i add? in the device info part of the d link router i have found a number of ip address's... but none of them seem to work? what am i doing wrong? or not doing? my apple base station is set up in the bridge mode with a password to protect it...
    thanks again...
    josh

  • Why can't I run the latest Java on Firefox to operate my network camera? It does not find Java. Please Help!!

    I just installed a network camera in my home correctly and signed in to view what was on the camera. But after logging in , info comes up with" cannot find Java" with an install button. I have the latest update of Java and the Firefox browser. There is no red block in the search bar that asks me to allow the site to use Java nor does it ask me to allow the site. I did uncheck the box in the control panel as it tells me to do in Java so that it asks me to use Java. Nothing works. I am so tired of installing and uninstalling, clearing my cache. Opening and closing my browser and reading info to fix this. I just want to be able to view what my camera films. Nothing on the firefox site answers or solves my problem. And believe me I've tried til my head is spinning. Someone has to have an answer. I need a vacation after this...Lol...
    Thanks...

    The Java plugin doesn't show in the System Details List.
    Is 32 bit Java installed on your computer?
    You can find the latest Java version on the Oracle website.<br />
    See Java Platform > Java SE 7U45 (JRE Download)
    *http://www.oracle.com/technetwork/java/javase/downloads/index.html
    You need the 32 bit JRE for Firefox.

  • Wireless Network Cameras

    Can anyone explaing to me step-by-step, how to attach a wireless video camera to my network and have my Mac recognize it. I just returned to amazom.com my Linksys wvc54g cause mac won't recognize it. I would like to use Evocam or Security Spy, or IveZeen in order to record wireless video.
    Is anyone out there knowledgable about this keeping in mind that most of us are novices at networking. I set up my Linksys router to my Airport extreme card in my G5, and it's working fine. Only, I want to purchase a wireless camera, ( a D-Link 900W I hear works).
    Any help here would be greatly appreciated. I have been using Macs since 1984 so I am a little familiar with all the other aspects of my G5.
    Thanks in advance for your replys.

    I googled "wireless network camera for mac" and came up with, among others, this:
    http://www.google.com/products?client=safari&rls=en&q=wirelessnetwork+cameras+formac.&oe=UTF-8&um=1&ie=UTF-8&ei=U6SSaWaOorhtgfN0oVR&sa=X&oi=product_resultgroup&resnum=1&ct=title
    You can do the rest...

Maybe you are looking for

  • Abap mapping - pb on SAP example?

    Hi, I try to use an Abap mapping for flow "IDoc -> XI -> structured file". For that I have modified the 1st example of SAP (by changing line: "direct = 1"). https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi-how-t

  • My iPhoto is Missing (completely)!?

    I got a new MacPro at work and it was bare/stripped/empty. I installed OSX 10.6.2 from a snow leapord disk. Everything is fine and it works good except that iPhoto is no where to be found. I did searches looked, nothing that even says iPhoto. How do

  • How to determine Charge types in forwarding order ?

    Hi Experts, I am new to SAP TM, I am configuring the charge management. Please provide step by step configurations to determine charge types automatically in forwarding order ASAP. Thanks, Shakti

  • Reg : IDOC Monitoring

    Hi All,        Could any one please let me know abt the IDOC Monitoring technique?        What are all the things we need to take care in idoc monitoring?       Any inputs will be of gr8 use. Thanks in advance. Regards Abhilash.

  • Conventional "sharpen after resizing" workflow?

    Conventional PS wisdom has been to resize your image to the desired output size and then sharpen (optimizing for the new size) as the last step. When I saw that explicitly doing that workflow was impossible in Aperture (which mandates doing all your