This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

采用灰点相机USB3.1 Blackfly S 进行二次开发时,TIDA-00361_LCr3000开发包如何修改?

Other Parts Discussed in Thread: TIDA-00361, DLP-ALC-LIGHTCRAFTER-SDK, TIDA-00554

TIDA-00361_LCr3000开发包是针对USB接口灰点相机,而且调用的好像是FlyCapture2_C.dll。  现在我想用灰点相机USB3.1 Blackfly S 进行二次开发时,但是现在Blackfly S相机用的新的sdk (Spinnaker),对应的dll是 Spinnaker-V120.dll。那么我在修改TIDA-00361_LCr3000开发包的时候,是不是应该用Spinnaker-V120.dll替换原来的FlyCapture2_C.dll?替换完之后,程序的其它地方还有需要修改的地方吗?

非常感谢!

  • C:\TexasInstruments-DLP\tida-00554\DLP-ALC-LIGHTCRAFTER-SDK-2.0\DLP-ALC-LIGHTCRAFTER-SDK\src\camera

    C:\TexasInstruments-DLP\tida-00554\DLP-ALC-LIGHTCRAFTER-SDK-2.0\DLP-ALC-LIGHTCRAFTER-SDK\include\camera

    下camera.cpp

    camera.h

    API都要核对.

  • 非常感谢您的回复。

    请问

    1)是C:\TexasInstruments-DLP\DLP-ALC-LIGHTCRAFTER-SDK-2.0\DLP-ALC-LIGHTCRAFTER-SDK\src\camera 和C:\TexasInstruments-DLP\DLP-ALC-LIGHTCRAFTER-SDK-2.0\DLP-ALC-LIGHTCRAFTER-SDK\include\camera下的camera.h和camera.cpp吗?

    2)其它的.h和.cpp需要修改吗?比如 pg_flycap2_c.cpp这个文件还需要吗,需要修改吗?

    3)camera.h和camera.cpp的api是什么东西?比如camera.cpp里哪些代码是api?

    非常感谢!

    /** @file   camera.cpp
     *  @brief  Contains methods for dlp::Camera class
     *  @copyright 2016 Texas Instruments Incorporated - http://www.ti.com/ ALL RIGHTS RESERVED
     */

    // DLP Structured Light SDK header files
    #include <common/debug.hpp>                     // Adds dlp::Debug
    #include <common/other.hpp>                     // Adds dlp::CmdLine, Time, File, String, Number namespaces
    #include <common/returncode.hpp>                // Adds dlp::ReturnCode
    #include <common/image/image.hpp>               // Adds dlp::Image
    #include <common/parameters.hpp>                // Adds dlp::Parameter
    #include <camera/camera.hpp>                    // Adds dlp::Camera
    #include <common/capture/capture.hpp>           // Adds dlp::Capture and dlp::Capture::Sequence
    #include <common/module.hpp>                    // Adds dlp::Module

    // C++ standard header files
    #include <atomic>                               // Adds std::atomic_bool
    #include <string>                               // Adds std::string
    #include <thread>                               // Adds std::thread
    #include <functional>                           // Adds std::ref

    namespace dlp{

    /** @brief      Opens \ref dlp::Image::Window of the most recent frame in a camera buffer
     *  @param[in] title            String title of the live view window
     *  @param[in] camera           \ref dlp::Camera object to retrieve frames from
     *  @param[in] continue_view    Live view window will close if continuw_view is false
     *  @param[in] delay_ms         Time between displayed frames (does NOT need to match camera frame rate)
     *  @param[in] width            Width in pixels of the live view window
     *  @param[in] height           Height in pixels of the live view window
     *  @bug This function may not operate correctly on Linux or Mac because of multi-threading issues with OpenCV's namedWindow and imshow
     */
    void CameraLiveView(const std::string title, dlp::Camera &camera, std::atomic_bool &continue_view, const unsigned int &delay_ms = 16, unsigned int width = 0, unsigned int height = 0){
        dlp::Image::Window* camera_view = new dlp::Image::Window();
        dlp::Image  captured_image;
        dlp::ReturnCode ret;

        // Open the camera view window
        camera_view->Open(title);

        // Wait for the escape key to be pressed or flag
        unsigned int return_key = 0;
        while((return_key != 27) && continue_view){ // 27 is ASCII code for ESC key

            // Clear the previous image
            captured_image.Clear();

            // Grab the most recent frame
            ret = camera.GetFrame(&captured_image);

            // Display the image if no errors occurred
            if(!ret.hasErrors()){
                if((width == 0)||(height ==0))   camera_view->Update(captured_image);
                else    camera_view->Update(captured_image,width,height);
            }

            // Delay 1ms and get any keys that are pressed from window
            camera_view->WaitForKey(delay_ms,&return_key);
        }

        // Close the camera view
        camera_view->Close();

        // Set flag to false so outside world knows the window has closed
        continue_view = false;

        delete camera_view;
    }

    /** @brief      Opens \ref dlp::Image::Window and displays all images in the camera buffer
     *  @param[in] title            String title of the live view window
     *  @param[in] camera           \ref dlp::Camera object to retrieve frames from
     *  @param[in] continue_view    Live view window will close if continuw_view is false
     *  @param[in] delay_ms         Time between displayed frames (does NOT need to match camera frame rate)
     *  @param[in] width            Width in pixels of the live view window
     *  @param[in] height           Height in pixels of the live view window
     *  @bug This function may not operate correctly on Linux or Mac because of multi-threading issues with OpenCV's namedWindow and imshow
     */
    void CameraBufferedView(const std::string title, dlp::Camera &camera, std::atomic_bool &continue_view, const unsigned int &delay_ms = 16, unsigned int width = 0, unsigned int height = 0){
        dlp::Image::Window* camera_view = new dlp::Image::Window();
        dlp::Image  captured_image;
        dlp::ReturnCode ret;

        // Open the camera view window
        camera_view->Open(title);

        // Wait for the escape key to be pressed or flag
        unsigned int return_key = 0;
        while((return_key != 27) && continue_view){ // 27 is ASCII code for ESC key

            // Clear the previous image
            captured_image.Clear();

            // Grab the most recent frame
            ret = camera.GetFrameBuffered(&captured_image);

            // Display the image if no errors occurred
            if(!ret.hasErrors()){
                if((width == 0)||(height ==0))   camera_view->Update(captured_image);
                else    camera_view->Update(captured_image,width,height);
            }

            // Delay 1ms and get any keys that are pressed from window
            camera_view->WaitForKey(delay_ms,&return_key);
        }

        // Close the camera view
        camera_view->Close();

        // Set flag to false so outside world knows the window has closed
        continue_view = false;

        delete camera_view;
    }

    /** @brief      Opens \ref dlp::Image::Window of the most recent frame in a camera buffer
     *  @param[in] title            String title of the live view window
     *  @param[in] camera           \ref dlp::Camera object to retrieve frames from
     *  @param[in] continue_view    Live view window will close if continuw_view is false
     *  @param[in] delay_ms         Time between displayed frames (does NOT need to match camera frame rate)
     */
    void Camera::StartLiveView(dlp::Camera &camera, std::string title, std::atomic_bool &continue_view, const unsigned int &delay_ms){
        unsigned int width = 0;
        unsigned int height = 0;

        camera.GetColumns(&width);
        camera.GetRows(&height);

        std::thread camera_view_thread(CameraLiveView,
                                       title,
                                       std::ref(camera),
                                       std::ref(continue_view),
                                       std::ref(delay_ms),
                                       width,
                                       height);
        camera_view_thread.detach();
    }


    /** @brief      Opens \ref dlp::Image::Window and displays all images in the camera buffer
     *  @param[in] title            String title of the live view window
     *  @param[in] camera           \ref dlp::Camera object to retrieve frames from
     *  @param[in] continue_view    Live view window will close if continuw_view is false
     *  @param[in] delay_ms         Time between displayed frames (does NOT need to match camera frame rate)
     */
    void Camera::StartBufferedView(dlp::Camera &camera, std::string title, std::atomic_bool &continue_view, const unsigned int &delay_ms){
        unsigned int width = 0;
        unsigned int height = 0;

        camera.GetColumns(&width);
        camera.GetRows(&height);

        std::thread camera_view_thread(CameraBufferedView,
                                       title,
                                       std::ref(camera),
                                       std::ref(continue_view),
                                       std::ref(delay_ms),
                                       width,
                                       height);
        camera_view_thread.detach();
    }

    /** @brief Loads \ref dlp::Parameters file and calls \ref dlp::Camera::Connect and \ref dlp::Camera::Setup for supplied \ref dlp::Camera object
     */
    ReturnCode Camera::ConnectSetup(dlp::Camera &camera, std::string id, std::string parameters_file, bool output_cmdline){
        dlp::ReturnCode ret;
        dlp::Parameters settings;

        // Load the parameters from a file
        ret = settings.Load(parameters_file);
        if(ret.hasErrors()){
            if(output_cmdline){
                dlp::CmdLine::Print("Loading parameters file FAILED!");
                dlp::CmdLine::Print(ret.ToString());
            }
            return ret;
        }

        return ConnectSetup(camera, id, settings, output_cmdline);
    }

    /** @brief Calls \ref dlp::Camera::Connect and \ref dlp::Camera::Setup for supplied \ref dlp::Camera object
     */
    ReturnCode Camera::ConnectSetup(dlp::Camera &camera, std::string id, const dlp::Parameters &settings, bool output_cmdline){
        dlp::ReturnCode ret;

        // Connect the projector
        dlp::CmdLine::Print("Connecting to camera...");
        ret = camera.Connect(id);
        if(ret.hasErrors()){
            if(output_cmdline){
                dlp::CmdLine::Print("Connecting to camera FAILED!");
                dlp::CmdLine::Print(ret.ToString());
            }
            return ret;
        }

        // Setup the projector
        dlp::CmdLine::Print("Configuring camera...");
        ret = camera.Setup(settings);
        if(ret.hasErrors()){
            if(output_cmdline){
                dlp::CmdLine::Print("Camera setup FAILED!");
                dlp::CmdLine::Print(ret.ToString());
            }
        }

        return ret;
    }

    }

  • 1)对的.

    2)根据API需要,可能需要的.至少得编译通过.

    3)都是的,要一个一个FUNCTION检查.