Grasshopper 2.0 MP Color FireWire 1394b (Sony ICX274)

简介:

相机参数如下,参见这里

Resolution 1624 x 1224
Frame Rate 30 FPS
Megapixels 2.0 MP
Chroma Color
Sensor Name Sony ICX274
Sensor Type CCD
Readout Method Global shutter
Sensor Format 1/1.8"
Pixel Size 4.4 µm
Lens Mount C-mount
ADC 14-bit
Gain Range 0 dB to 24 dB
Exposure Range 0.02 ms to >10 seconds
Trigger Modes Standard, bulb, skip frames, overlapped, multi-shot
Partial Image Modes Pixel binning, ROI
Image Processing Gamma, lookup table, white balance
Image Buffer 32 MB
User Sets 2 memory channels for custom camera settings
Flash Memory 512 KB non-volatile memory
Non-isolated I/O Ports 2 bi-directional
Serial Port 1 (over non-isolated I/O)
Auxiliary Output 3.3 V, 150 mA maximum
Interface FireWire 1394b
Power Requirements 8 to 30 V
Power Consumption (Maximum) 3.5 W at 12 V
Dimensions 44 mm x 29 mm x 58 mm
Mass 104 g
Machine Vision Standard IIDC v1.31
Compliance CE, FCC, KCC, RoHS
Temperature (Operating) 0° to 40°C
Temperature (Storage) -30° to 60°C
Humidity (Operating) 20 to 80% (no condensation)
Humidity (Storage) 20 to 95% (no condensation)
Warranty 3 years

Sample Code for Capturing Images:

#include "FlyCapture2.h"
#include <string>
#include <vector>
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>
#include <iostream>
using namespace FlyCapture2;
using namespace std;
using namespace cv;

enum AviType
{
    UNCOMPRESSED,
    MJPG,
    H264
};

void PrintError( Error error )
{
    error.PrintErrorTrace();
}

void PrintCameraInfo( CameraInfo* pCamInfo )
{
    printf(
        "\n*** CAMERA INFORMATION ***\n"
        "Serial number - %u\n"
        "Camera model - %s\n"
        "Camera vendor - %s\n"
        "Sensor - %s\n"
        "Resolution - %s\n"
        "Firmware version - %s\n"
        "Firmware build time - %s\n\n",
        pCamInfo->serialNumber,
        pCamInfo->modelName,
        pCamInfo->vendorName,
        pCamInfo->sensorInfo,
        pCamInfo->sensorResolution,
        pCamInfo->firmwareVersion,
        pCamInfo->firmwareBuildTime );
}

void SaveAviHelper(
    AviType aviType,
    std::vector<Image>& vecImages,
    std::string aviFileName,
    float frameRate)
{
    Error error;
    AVIRecorder aviRecorder;

    // Open the AVI file for appending images

    switch (aviType)
    {
    case UNCOMPRESSED:
        {
            AVIOption option;
            option.frameRate = frameRate;
            error = aviRecorder.AVIOpen(aviFileName.c_str(), &option);
        }
        break;
    case MJPG:
        {
            MJPGOption option;
            option.frameRate = frameRate;
            option.quality = 75;
            error = aviRecorder.AVIOpen(aviFileName.c_str(), &option);
        }
        break;
    case H264:
        {
            H264Option option;
            option.frameRate = frameRate;
            option.bitrate = 1000000;
            option.height = vecImages[0].GetRows();
            option.width = vecImages[0].GetCols();
            error = aviRecorder.AVIOpen(aviFileName.c_str(), &option);
        }
        break;
    }

    if (error != PGRERROR_OK)
    {
        PrintError(error);
        return;
    }

    printf( "\nAppending %d images to AVI file: %s ... \n", vecImages.size(), aviFileName.c_str() );
    for (int imageCnt = 0; imageCnt < vecImages.size(); imageCnt++)
    {
        // Append the image to AVI file
        error = aviRecorder.AVIAppend(&vecImages[imageCnt]);
        if (error != PGRERROR_OK)
        {
            PrintError(error);
            continue;
        }

        printf("Appended image %d...\n", imageCnt);
    }

    // Close the AVI file
    error = aviRecorder.AVIClose( );
    if (error != PGRERROR_OK)
    {
        PrintError(error);
        return;
    }
}

int main(int /*argc*/, char** /*argv*/)
{
    Error error;
    BusManager busMgr;
    unsigned int numCameras;
    error = busMgr.GetNumOfCameras(&numCameras);
    if (error != PGRERROR_OK)
    {
        PrintError(error);
        return -1;
    }
    cout << "numCameras = " << numCameras << endl;
    if ( numCameras < 1 )
    {
        printf( "No camera detected.\n" );
        return -1;
    }
    else
    {
        printf( "Number of cameras detected: %u\n", numCameras );
    }

    PGRGuid guid;
    error = busMgr.GetCameraFromIndex(0, &guid);
    if (error != PGRERROR_OK)
    {
        PrintError(error);
        return -1;
    }
    printf( "Running the first camera.\n" );

    Camera cam;
    // Connect to a camera
    error = cam.Connect(&guid);
    if (error != PGRERROR_OK)
    {
        PrintError(error);
        return -1;
    }

    // Get the camera information
    CameraInfo camInfo;
    error = cam.GetCameraInfo(&camInfo);
    if (error != PGRERROR_OK)
    {
        PrintError(error);
        return -1;
    }
    PrintCameraInfo(&camInfo);

    // Start capturing images
    printf( "Starting capture... \n" );
    error = cam.StartCapture();
    if (error != PGRERROR_OK)
    {
        PrintError(error);
        return -1;
    }

    // The total number of images
    const int k_numImages = 100;
    std::vector<Image> vecImages;
    vecImages.resize(k_numImages);

    // Grab images
    Image rawImage;
    for ( int imageCnt=0; imageCnt < k_numImages; imageCnt++ )
    {
        error = cam.RetrieveBuffer(&rawImage);
        if (error != PGRERROR_OK)
        {
            printf("Error grabbing image %u\n", imageCnt);
            continue;
        }
        else
        {
            printf("Grabbed image %u\n", imageCnt);
        }

        vecImages[imageCnt].DeepCopy(&rawImage);
    }

    // Stop capturing images
    printf( "Stopping capture... \n" );
    error = cam.StopCapture();
    if (error != PGRERROR_OK)
    {
        PrintError(error);
        return -1;
    }

    // Check if the camera supports the FRAME_RATE property
    printf( "Detecting frame rate from camera... \n" );
    PropertyInfo propInfo;
    propInfo.type = FRAME_RATE;
    error = cam.GetPropertyInfo( &propInfo );
    if (error != PGRERROR_OK)
    {
        PrintError(error);
        return -1;
    }

    float frameRateToUse = 15.0f;
    if ( propInfo.present == true )
    {
        // Get the frame rate
        Property prop;
        prop.type = FRAME_RATE;
        error = cam.GetProperty( &prop );
        if (error != PGRERROR_OK)
        {
            PrintError(error);
        }
        else
        {
            // Set the frame rate.
            // Note that the actual recording frame rate may be slower,
            // depending on the bus speed and disk writing speed.
            frameRateToUse = prop.absValue;
        }
    }

    printf("Using frame rate of %3.1f\n", frameRateToUse);

    char aviFileName[512] = {0};

    sprintf(aviFileName, "SaveImageToAviEx-Uncompressed-%u", camInfo.serialNumber);
    SaveAviHelper(UNCOMPRESSED, vecImages, aviFileName, frameRateToUse);

    // Disconnect the camera
    error = cam.Disconnect();
    if (error != PGRERROR_OK)
    {
        PrintError(error);
        return -1;
    }

    system("Pause");
    return 0;
}

 本文转自博客园Grandyang的博客,原文链接:Grasshopper 2.0 MP Color FireWire 1394b (Sony ICX274),如需转载请自行联系原博主。

相关文章
|
7月前
|
编解码 Linux 开发工具
瑞芯微RV1109支持V4L2 Camera
瑞芯微RV1109支持V4L2 Camera
109 0
|
3月前
来看看生词:CVBS、S-Video、YPbPr、模拟RGB、DVI和HDMI
来看看生词:CVBS、S-Video、YPbPr、模拟RGB、DVI和HDMI
65 0
|
4月前
|
传感器
|
6月前
|
JavaScript
08HUI - 媒体列表(hui-media-list-img)
08HUI - 媒体列表(hui-media-list-img)
14 0
|
8月前
|
内存技术
Gold Flash引发的一系列思考
Gold Flash引发的一系列思考
114 0
|
C++
RGBA 编码为 YUV420SP【NEON】
RGBA 编码为 YUV420SP【NEON】
335 0
RGBA 编码为 YUV420SP【NEON】
|
安全 iOS开发
Can iPhone X Face ID Be Cracked?
Apple's Face ID claims to be immune to spoofing from masks, but a Vietnamese cybersecurity firm defies this claim.
2616 0
|
Android开发 数据格式 XML
Android LED数字/电子表字体digital font
Android LED数字/电子表字体digital font 先看实现的字体样式: 这种类型的字体样式会被一些UI设计用于Android APP中视频,或者广告的倒计时牌,比如常见的Android视频直播软件中右上角的广告倒计时。
1919 0
|
存储 芯片 内存技术
《我和PIC单片机:基于PIC18》——第1章 初识PIC 1.1 与众不同的PIC
本节书摘来自华章计算机《我和PIC单片机:基于PIC18》一书中的第1章,第1.1节,作者 高显生,更多章节内容可以访问云栖社区“华章计算机”公众号查看。
2486 0

热门文章

最新文章