summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2013-08-29 15:35:32 +0100
committerTim Redfern <tim@eclectronics.org>2013-08-29 15:35:32 +0100
commit486a76df31169f2b510ae26e8252783d8f90de27 (patch)
tree20df24d88064a0bbaf6ba6c8027120a5f4f9acf6
parentcaed9b7b05005ee2bcec8e7262bf5f63fe2a4df8 (diff)
making still image node
-rw-r--r--rotord/Makefile2
-rw-r--r--rotord/src/cvimage.h10
-rwxr-xr-xrotord/src/rotor.cpp1
-rwxr-xr-xrotord/src/rotor.h30
4 files changed, 41 insertions, 2 deletions
diff --git a/rotord/Makefile b/rotord/Makefile
index 2842cf1..25159b0 100644
--- a/rotord/Makefile
+++ b/rotord/Makefile
@@ -9,7 +9,7 @@ MY_CFLAGS = -fpermissive -std=c++11 -I /usr/include/opencv -I /usr/include/cairo
# -I ../ffmpeg
# The linker options.libgstaasinklibgstaasink.so
-MY_LIBS = -ljsoncpp -lcairo -lopencv_core -lopencv_video -lopencv_imgproc -lPocoNet -lPocoXML -lPocoUtil -lPocoFoundation -lvamp-hostsdk -lsndfile -L /usr/local/lib -lswscale -lavcodec -lavformat -lavfilter -lavdevice -lavutil -lstdc++ -lm
+MY_LIBS = -ljsoncpp -lcairo -lopencv_core -lopencv_video -lopencv_imgproc -lopencv_highgui -lPocoNet -lPocoXML -lPocoUtil -lPocoFoundation -lvamp-hostsdk -lsndfile -L /usr/local/lib -lswscale -lavcodec -lavformat -lavfilter -lavdevice -lavutil -lstdc++ -lm
#-lopencv_highgui
#MY_LIBS = -lPocoNet -lPocoXML -lPocoUtil -lPocoFoundation -lvamp-hostsdk -lsndfile -L /usr/local/lib -lswscale -lavcodec -lavformat -lavfilter -lavdevice -lavutil $(shell pkg-config gstreamer-0.10 gstreamer-video-0.10 gstreamer-base-0.10 --libs)
# -lgstreamer-0.10 -lgstreamer-video-0.10 -lgstreamer-base-0.10 -lglib-2.0 -lgstapp-0.10
diff --git a/rotord/src/cvimage.h b/rotord/src/cvimage.h
index dc421de..6323d4d 100644
--- a/rotord/src/cvimage.h
+++ b/rotord/src/cvimage.h
@@ -3,6 +3,7 @@
#include <math.h>
#include <cv.h>
+#include <highgui.h>
//converting to use a cv image...
//cv::Mat supports most of what we want here
@@ -120,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 299510a..77f7743 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: