#include <HxMfBpo.h>
Public Methods | |
HxMfBpo (HxImageData *src1, HxImageData *src2, HxString bpoName) | |
Constructor. More... | |
~HxMfBpo () | |
Destructor. More... | |
HxImageData * | source1 () const |
The first argument image of the frame. More... | |
HxImageData * | source2 () const |
The second argument image of the frame. More... | |
HxImageData * | result () const |
The result image of the frame. More... | |
bool | preOpIsOk () const |
Indicates whether initialization was OK. More... |
First queries the HxImgFtorRuleBase for an exact match on
resulttype of bpo<src1,src2,bpoName>
If that is not found we look for
argumenttype of bpo<src1,bpoName>
If the argumenttype is not found or it does not match the signature of src2 we try to find
argumenttype of bpo<broadest(src1,src2),bpoName>
If that is also not found, an error is generated. Based on the argumenttype we find the resulttype with
resulttype of bpo<argumenttype,bpoName>
|
Constructor.
00017 : _src1(src1), _src2(src2), _tmpSrc1(0), _tmpSrc2(0), _preOpIsOk(true) 00018 { 00019 if (!src1 || !src2) 00020 { 00021 _preOpIsOk = false; 00022 return; 00023 } 00024 00025 HxImageSignature src1Sig(src1->signature()); 00026 HxImageSignature src2Sig(src2->signature()); 00027 HxImageSignature broadestSig(src1Sig.broadest(src2Sig)); 00028 HxImageSignature resultSig; 00029 00030 HxImgFtorRuleBase::QueryResultType qRes; 00031 00032 qRes = HxImgFtorRuleBase::instance().getResultType( 00033 src1Sig, "bpo", 00034 src1Sig.toString(), src2Sig.toString(), bpoName); 00035 00036 if (qRes) 00037 { 00038 /* 00039 * Only very specific combinations of argument types allowed. 00040 * Argument types stay what they are. 00041 */ 00042 resultSig = qRes; 00043 } 00044 else 00045 { 00046 // Type of result and second argument depends on type of first 00047 // argument. 00048 00049 qRes = HxImgFtorRuleBase::instance().getArgumentType( 00050 src1Sig, "bpo", src1Sig.toString(), bpoName); 00051 00052 src1Sig = (qRes && src2Sig.isEqual(qRes)) ? src1Sig : broadestSig; 00053 00054 // If type of second argument does not fit the required type 00055 // another attempt is made with the broadest signature. 00056 /* 24/01/2001 IMPORTANT DESIGN NOTE: 00057 * One can argue that if a second argument type can be found 00058 * when querying with the original first argument type as key, 00059 * and the given second argument type does not match the query result, 00060 * the second argument should be converted to the query result, but 00061 * only when the query result is broader than the second argument 00062 * type. 00063 */ 00064 // src1Sig = (qRes && src2Sig.broadest(qRes).isEqual(qRes)) 00065 // ? src1Sig : broadestSig; 00066 00067 qRes = HxImgFtorRuleBase::instance().getArgumentType( 00068 src2Sig, "bpo", src1Sig.toString(), bpoName); 00069 00070 if (!qRes) 00071 { 00072 HxEnvironment::instance()->errorStream() 00073 << "Cannot apply binary pixel operation " << bpoName << " to " 00074 << "images with type " << src1Sig.toString() << " and " 00075 << src2Sig.toString() << STD_ENDL; 00076 HxEnvironment::instance()->flush(); 00077 _preOpIsOk = false; 00078 } 00079 else 00080 { 00081 src2Sig = qRes; 00082 } 00083 00084 resultSig = HxImgFtorRuleBase::instance().getResultType( 00085 src1Sig, "bpo", src1Sig.toString(), bpoName); 00086 } 00087 00088 HxSizes sizes = src1->sizes().sup(src2->sizes()); 00089 00090 if (!src1Sig.isEqual(src1->signature())) { 00091 _tmpSrc1 = HxImgDataFactory::instance().makeImage(src1Sig, sizes); 00092 _tmpSrc1->set(src1); 00093 _src1 = _tmpSrc1; 00094 } 00095 00096 if (!src2Sig.isEqual(src2->signature())) { 00097 _tmpSrc2 = HxImgDataFactory::instance().makeImage(src2Sig, sizes); 00098 _tmpSrc2->set(src2); 00099 _src2 = _tmpSrc2; 00100 } 00101 00102 _result = HxImgDataFactory::instance().makeImage(resultSig, sizes); 00103 00104 } |
|
Destructor.
00107 { 00108 if (_tmpSrc1) 00109 delete _tmpSrc1; 00110 if (_tmpSrc2) 00111 delete _tmpSrc2; 00112 } |
|
The first argument image of the frame.
00116 { 00117 return _src1; 00118 } |
|
The second argument image of the frame.
00122 { 00123 return _src2; 00124 } |
|
The result image of the frame.
00128 { 00129 return _result; 00130 } |
|
Indicates whether initialization was OK.
00072 { 00073 return _preOpIsOk; 00074 } |