00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #include "Channels/ImagizeColorChannel.H"
00039
00040 #include "Channels/ChannelOpts.H"
00041 #include "Channels/ImagizeAlphaChannel.H"
00042 #include "Channels/ImagizeBetaChannel.H"
00043 #include "Channels/ImagizeLedChannel.H"
00044 #include "Component/ModelOptionDef.H"
00045 #include "Component/OptionManager.H"
00046 #include "Image/ColorOps.H"
00047 #include "rutz/trace.h"
00048
00049 const ModelOptionDef OPT_ImagizeColorChannelAweight =
00050 { MODOPT_ARG(float), "ImagizeColorChannelAweight", &MOC_CHANNEL, OPTEXP_CORE,
00051 "Weight to assign to the Alpha component of the Imagize color channel",
00052 "imgz-a-weight", '\0', "<float>", "1.0" };
00053
00054 const ModelOptionDef OPT_ImagizeColorChannelBweight =
00055 { MODOPT_ARG(float), "ImagizeColorChannelBweight", &MOC_CHANNEL, OPTEXP_CORE,
00056 "Weight to assign to the Beta component of the Imagize color channel",
00057 "imgz-b-weight", '\0', "<float>", "1.0" };
00058
00059 const ModelOptionDef OPT_ImagizeColorChannelLweight =
00060 { MODOPT_ARG(float), "ImagizeColorChannelLweight", &MOC_CHANNEL, OPTEXP_CORE,
00061 "Weight to assign to the Led component of the Imagize color channel",
00062 "imgz-l-weight", '\0', "<float>", "1.0" };
00063
00064
00065
00066
00067
00068 ImagizeColorChannel::ImagizeColorChannel(OptionManager& mgr) :
00069 ComplexChannel(mgr, "ImagizeComposite", "ImagizeComposite", IMGZCOLOR),
00070 itsAweight(&OPT_ImagizeColorChannelAweight, this),
00071 itsBweight(&OPT_ImagizeColorChannelBweight, this),
00072 itsLweight(&OPT_ImagizeColorChannelLweight, this),
00073 itsA(new ImagizeAlphaChannel(getManager(), true)),
00074 itsB(new ImagizeBetaChannel(getManager(), true)),
00075 itsL(new ImagizeLedChannel(getManager(), true))
00076 {
00077 GVX_TRACE(__PRETTY_FUNCTION__);
00078
00079 this->addSubChan(itsA);
00080 this->addSubChan(itsB);
00081 this->addSubChan(itsL);
00082 }
00083
00084
00085 ImagizeAlphaChannel& ImagizeColorChannel::alpha() const
00086 {
00087 GVX_TRACE(__PRETTY_FUNCTION__);
00088 return *itsA;
00089 }
00090
00091
00092 ImagizeBetaChannel& ImagizeColorChannel::beta() const
00093 {
00094 GVX_TRACE(__PRETTY_FUNCTION__);
00095 return *itsB;
00096 }
00097
00098
00099 ImagizeLedChannel& ImagizeColorChannel::led() const
00100 {
00101 GVX_TRACE(__PRETTY_FUNCTION__);
00102 return *itsL;
00103 }
00104
00105
00106 ImagizeColorChannel::~ImagizeColorChannel()
00107 {
00108 GVX_TRACE(__PRETTY_FUNCTION__);
00109 }
00110
00111
00112 void ImagizeColorChannel::start1()
00113 {
00114 LINFO("Using a weight of %f for Alpha subchannel", itsAweight.getVal());
00115 setSubchanTotalWeight(*itsA, itsAweight.getVal());
00116
00117 LINFO("Using a weight of %f for Beta subchannel", itsBweight.getVal());
00118 setSubchanTotalWeight(*itsB, itsBweight.getVal());
00119
00120 LINFO("Using a weight of %f for LED subchannel", itsLweight.getVal());
00121 setSubchanTotalWeight(*itsL, itsLweight.getVal());
00122 }
00123
00124
00125 void ImagizeColorChannel::doInput(const InputFrame& inframe)
00126 {
00127 GVX_TRACE(__PRETTY_FUNCTION__);
00128
00129
00130
00131 LINFO("Converting input image to Alpha-Beta-LED colors.");
00132 Image<byte> aimg, bimg, limg;
00133 getComponents(inframe.colorByte(), aimg, bimg, limg);
00134
00135
00136 Image<float> a = aimg, b = bimg, l = limg;
00137
00138
00139 itsA->input(InputFrame::fromGrayFloat(&a, inframe.time(), &inframe.clipMask(), inframe.pyrCache()));
00140 itsB->input(InputFrame::fromGrayFloat(&b, inframe.time(), &inframe.clipMask(), inframe.pyrCache()));
00141 itsL->input(InputFrame::fromGrayFloat(&l, inframe.time(), &inframe.clipMask(), inframe.pyrCache()));
00142 LINFO("Imagize Color channel ok.");
00143 }
00144
00145
00146
00147
00148
00149