This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cv::Mat m(480, 640, CV_8UC3); | |
| Magick::Image i(m.cols, m.rows, "BGR", Magick::CharPixel, reinterpret_cast<char*>(m.data)); | |
| constexpr int jpeg_quality = 60; | |
| Magick::Blob buffer; | |
| i.magick("JPEG"); | |
| i.quality(jpeg_quality); | |
| i.write(&buffer); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cv::Mat m(480, 640, CV_8UC3); | |
| Magick::Image i(m.cols, m.rows, "BGR", Magick::CharPixel, reinterpret_cast<char*>(m.data)); | |
| Magick::Blob buffer; | |
| i.compressType(Magick::LZWCompression); | |
| i.magick("TIFF"); | |
| i.write(&buffer); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <vector> | |
| #include <string> | |
| #include <iostream> | |
| int main(const int number_of_arguments_c, const char* const* const arguments_c) | |
| { | |
| const std::vector<std::string> arguments_cxx(arguments_c + 1, arguments_c + number_of_arguments_c); | |
| std::cerr << arguments_cxx.size() << '\n'; | |
| for(const auto& a : arguments_cxx) | |
| std::cerr << a << ' '; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <cmath> | |
| int main() | |
| { | |
| for(auto n = 0; n < 100; ++n) | |
| { | |
| float t = float(n) / 100; | |
| float f = 2.f; | |
| float a = 4.f * std::floor(t * f) - 2.f * std::floor(2.f * t * f) + 1.f; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // std::cout のためにC++標準ライブラリー iostream を使用。 | |
| #include <iostream> | |
| // std::runtime_error のためにC++標準ライブラリー stdexcept を使用。 | |
| #include <stdexcept> | |
| // Pythonバインディングのために /usr/include/python3.3/Ptyhon.h を使用。 | |
| #include <Python.h> | |
| // C++の無名名前空間で定義するよ | |
| namespace |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <memory> | |
| #include <iostream> | |
| template<class T> using S = std::enable_shared_from_this<T>; | |
| struct A: S<A> { auto fa() const -> void { std::cerr << this << "\n";} }; | |
| struct B: S<B>, A { auto fb() const -> void { std::cerr << this << "\n";} }; | |
| auto main() -> int | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <GL/glut.h> | |
| #include <iostream> | |
| auto main() -> int | |
| { | |
| int number_of_arguments = 0; | |
| glutInit(&number_of_arguments, nullptr); | |
| glutCreateWindow("glut key test"); | |
| glutKeyboardFunc([](unsigned char key, int x, int y){ std::cerr << +key << " " << x << " " << y << "\n"; }); | |
| glutMainLoop(); |