{"id":1470,"date":"2014-11-19T18:30:06","date_gmt":"2014-11-19T18:30:06","guid":{"rendered":"http:\/\/41j.com\/blog\/?p=1470"},"modified":"2014-11-19T18:30:06","modified_gmt":"2014-11-19T18:30:06","slug":"canon-ixy-60-ccd-experiments-part-2","status":"publish","type":"post","link":"https:\/\/41j.com\/blog\/2014\/11\/canon-ixy-60-ccd-experiments-part-2\/","title":{"rendered":"Canon Ixy 60 CCD experiments Part 2"},"content":{"rendered":"<p>Continuing on from my <a href=\"http:\/\/41j.com\/blog\/2014\/11\/canon-ixy-60-powershot-sd450\/\">previous post<\/a> on the Canon Ixy 60, I&#8217;ve been playing around a bit more and seem to have got some data out. Some rambling in the following video:<\/p>\n<p><iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"\/\/www.youtube.com\/embed\/7_f5h4PML-4?\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<p>I also tried throwing some data into the camera and seeing if it would show up on the camera LCD in the following video:<\/p>\n<p><iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"\/\/www.youtube.com\/embed\/bzt0IPNqksU\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<p>The code used in the video on the USRP is as follows. Next set is to build this out a bit and see if I can decode some image data:<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n#include &lt;uhd\/types\/tune_request.hpp&gt;\r\n#include &lt;uhd\/utils\/thread_priority.hpp&gt;\r\n#include &lt;uhd\/utils\/safe_main.hpp&gt;\r\n#include &lt;uhd\/usrp\/multi_usrp.hpp&gt;\r\n#include &lt;uhd\/exception.hpp&gt;\r\n#include &lt;iostream&gt;\r\n#include &lt;fstream&gt;\r\n#include &lt;csignal&gt;\r\n#include &lt;complex&gt;\r\n\r\nusing namespace std;\r\n\r\nint UHD_SAFE_MAIN(int argc, char *argv&#x5B;]){\r\n    uhd::set_thread_priority_safe();\r\n\r\n    uhd::usrp::multi_usrp::sptr usrp = uhd::usrp::multi_usrp::make(string(&quot;&quot;));\r\n\r\n    usrp-&gt;set_clock_source(&quot;internal&quot;); \/\/ set clock\r\n\r\n    \/\/always select the subdevice first, the channel mapping affects the other settings\r\n    usrp-&gt;set_rx_subdev_spec(string(&quot;A:A&quot;));\r\n\r\n    std::cout &lt;&lt; &quot;Using Device: &quot; &lt;&lt; usrp-&gt;get_pp_string() &lt;&lt; std::endl;\r\n    double rate = 1000000; \/\/ trying 1MSPS\r\n    usrp-&gt;set_rx_rate(rate);\r\n\r\n    \/\/set the center frequency\r\n    double freq=0;\r\n    uhd::tune_request_t tune_request(freq);\r\n    usrp-&gt;set_rx_freq(tune_request);\r\n\r\n    \/\/usrp-&gt;set_rx_gain(5);\r\n    \/\/usrp-&gt;set_rx_bandwidth(100);\r\n\r\n\/\/    ant = &quot;&quot;;\r\n\/\/    usrp-&gt;set_rx_antenna(ant);\r\n\r\n\/\/   cout &lt;&lt; usrp-&gt;get_mboard_sensor(&quot;lo_locked&quot;, 0).to_bool() &lt;&lt; endl;\r\n\r\n    sleep(1);\r\n\r\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ RECEIVE CODE\r\n\r\n    \/\/create a receive streamer\r\n    uhd::stream_args_t stream_args(&quot;sc16&quot;,&quot;&quot;);\r\n    uhd::rx_streamer::sptr rx_stream = usrp-&gt;get_rx_stream(stream_args);\r\n\r\n    uhd::rx_metadata_t md;\r\n    std::vector&lt;std::complex&lt;short&gt; &gt; buffer(1000000);\r\n\r\n    \/\/setup streaming\r\n    uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);\r\n    stream_cmd.num_samps = 0;\r\n    stream_cmd.stream_now = true;\r\n    stream_cmd.time_spec = uhd::time_spec_t();\r\n    rx_stream-&gt;issue_stream_cmd(stream_cmd);\r\n\r\n    for(;;) {\r\n\r\n        size_t num_rx_samps = rx_stream-&gt;recv(&amp;buffer.front(), buffer.size(), md, 3.0, false);\r\n\r\n        if (md.error_code == uhd::rx_metadata_t::ERROR_CODE_TIMEOUT) { cerr &lt;&lt; &quot;timeout&quot;  &lt;&lt; endl; }\r\n        if (md.error_code == uhd::rx_metadata_t::ERROR_CODE_OVERFLOW){ cerr &lt;&lt; &quot;overflow&quot; &lt;&lt; endl; }\r\n        if (md.error_code != uhd::rx_metadata_t::ERROR_CODE_NONE)    { cerr &lt;&lt;  md.strerror() &lt;&lt; endl; }\r\n \r\n\/*\r\n        double avg=0; double samps=0;\r\n        for(int n=0;n&lt;1000;n++) {\r\n          if(n&gt;0) avg -= avg\/samps;\r\n          avg += buffer&#x5B;n].real()\/(samps+1);\r\n          samps++;\r\n        }\r\n*\/\r\n        cout &lt;&lt; avg &lt;&lt; endl;\r\n  \/\/      cout &lt;&lt; &quot;data size: &quot; &lt;&lt; num_rx_samps &lt;&lt; &quot; first: &quot; &lt;&lt; (&amp;buffer.front())&#x5B;0] &lt;&lt; endl;\r\n    }\r\n\r\n    \/\/ Will never get here\r\n    stream_cmd.stream_mode = uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS;\r\n    rx_stream-&gt;issue_stream_cmd(stream_cmd);\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Continuing on from my previous post on the Canon Ixy 60, I&#8217;ve been playing around a bit more and seem to have got some data out. Some rambling in the following video: I also tried throwing some data into the camera and seeing if it would show up on the camera LCD in the following [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-1470","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1RRoU-nI","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/1470","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/comments?post=1470"}],"version-history":[{"count":1,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/1470\/revisions"}],"predecessor-version":[{"id":1471,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/1470\/revisions\/1471"}],"wp:attachment":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/media?parent=1470"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/categories?post=1470"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/tags?post=1470"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}