summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rotord/src/cvimage.h9
-rwxr-xr-xrotord/src/rotor.cpp1
-rwxr-xr-xrotord/src/rotor.h30
3 files changed, 39 insertions, 1 deletions
diff --git a/rotord/src/cvimage.h b/rotord/src/cvimage.h
index 68bdb48..6323d4d 100644
--- a/rotord/src/cvimage.h
+++ b/rotord/src/cvimage.h
@@ -121,6 +121,15 @@ namespace Rotor {
else return false;
*/
}
+ bool read_file(std::string &filename){
+ rgb=cv::imread(filename,CV_LOAD_IMAGE_COLOR);
+ if (rgb.empty()) return false;
+ RGBdata=rgb.data;
+ ownsRGBdata=false;
+ w=rgb.rows;
+ h=rgb.cols;
+ return true;
+ }
bool setup_fromRGB(int _w,int _h,uint8_t *pRGBdata,int linepadding=0){
//here the data belongs to libavcodec or other
//could move to using cv::Mat there also and just passing cv:Mat over
diff --git a/rotord/src/rotor.cpp b/rotord/src/rotor.cpp
index 9cd1d7c..591045d 100755
--- a/rotord/src/rotor.cpp
+++ b/rotord/src/rotor.cpp
@@ -44,6 +44,7 @@ Node_factory::Node_factory(){
add_type("video_loader",new Video_loader());
add_type("video_output",new Video_output());
add_type("video_feedback",new Video_feedback());
+ add_type("still_image",new Still_image());
}
bool Signal_input::connect(Node* source) {
connection=dynamic_cast<Signal_node*>(source);
diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h
index 2f0fab1..ae6b849 100755
--- a/rotord/src/rotor.h
+++ b/rotord/src/rotor.h
@@ -781,7 +781,35 @@ namespace Rotor {
return nullptr;
}
private:
- //todo - quality settings
+ };
+ class Still_image: public Image_node {
+ public:
+ Still_image(){
+ create_parameter("transformX","number","X transformation","Transform X",0.0f);
+ create_parameter("transformY","number","Y transformation","Transform X",0.0f);
+ create_parameter("originX","number","X transformation origin","Origin X",0.5f);
+ create_parameter("originY","number","Y transformation origin","Origin Y",0.5f);
+ create_parameter("rotation","number","Rotation about origin","Rotation",0.0f);
+ create_parameter("scale","number","Scale about origin","Scale",1.0f);
+ create_attribute("filter","Filtering mode","Filter mode","linear",{"nearest","linear","area","cubic","lanczos"});
+ create_attribute("filename","name of image file to load","File name","");
+ title="Still image";
+ description="Load a still image and apply 2D transformation";
+ };
+ Still_image(map<string,string> &settings):Still_image() {
+ base_settings(settings);
+ if (attributes["filename"]->value!=""){
+ string filewithpath=find_setting(settings,"media_path","")+attributes["filename"]->value;
+ image.read_file(filewithpath);
+ }
+ };
+ ~Still_image(){
+ };
+ Still_image* clone(map<string,string> &_settings) { return new Still_image(_settings);};
+ Image *output(const Frame_spec &frame){
+
+ }
+ private:
};
class Alpha_merge: public Image_node {
public: