Changeset 214 in flair-src for trunk/lib/FlairCore/src/Matrix.cpp
- Timestamp:
- Feb 7, 2018, 5:49:27 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairCore/src/Matrix.cpp
r213 r214 19 19 #include <typeinfo> 20 20 #include <string.h> 21 22 //#include <iostream>23 21 24 22 using std::string; … … 37 35 this->col = col; 38 36 if (row >= matrix->Rows() || col >= matrix->Cols()) { 39 matrix->Err("index (%i,%i) out of bound (%i,%i)\n", row, col,37 matrix->Err("index (%i,%i) out of bound, max (%i,%i)\n", row, col, 40 38 matrix->Rows() - 1, matrix->Cols() - 1); 41 39 size = 0; … … 71 69 } break; 72 70 } 71 } else if (typeid(matrix->GetDataType().GetElementDataType()) == 72 typeid(UnsignedIntegerType)) { 73 switch (matrix->GetDataType().GetElementDataType().GetSize()) { 74 case 1: { 75 uint8_t uint8Value = matrix->Value(row, col); 76 memcpy(dst, &uint8Value, 1); 77 } break; 78 case 2: { 79 uint16_t uint16Value = matrix->Value(row, col); 80 memcpy(dst, &uint16Value, 2); 81 } break; 82 } 73 83 } 74 84 } … … 133 143 if (row >= (uint32_t)pimpl_->descriptor->Rows() || 134 144 col >= (uint32_t)pimpl_->descriptor->Cols()) { 135 Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,145 Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col, 136 146 pimpl_->descriptor->Rows() - 1, pimpl_->descriptor->Cols() - 1); 137 147 return 0; … … 139 149 140 150 GetMutex(); 141 value = pimpl_-> datas[row][col];151 value = pimpl_->ValueNoMutex(row, col); 142 152 ReleaseMutex(); 143 153 … … 148 158 if (row >= (uint32_t)pimpl_->descriptor->Rows() || 149 159 col >= (uint32_t)pimpl_->descriptor->Cols()) { 150 Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,160 Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col, 151 161 pimpl_->descriptor->Rows() - 1, pimpl_->descriptor->Cols() - 1); 152 162 return 0; 153 163 } 154 164 155 return pimpl_-> datas[row][col];165 return pimpl_->ValueNoMutex(row, col); 156 166 } 157 167 … … 159 169 if (row >= (uint32_t)pimpl_->descriptor->Rows() || 160 170 col >= (uint32_t)pimpl_->descriptor->Cols()) { 161 Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,171 Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col, 162 172 pimpl_->descriptor->Rows() - 1, pimpl_->descriptor->Cols() - 1); 163 173 } else { 164 174 GetMutex(); 165 pimpl_-> datas[row][col]=value;175 pimpl_->SetValueNoMutex(row, col,value); 166 176 ReleaseMutex(); 167 177 } … … 171 181 if (row >= (uint32_t)pimpl_->descriptor->Rows() || 172 182 col >= (uint32_t)pimpl_->descriptor->Cols()) { 173 Warn("index (%i,%i) out of bound (%i,%i)\n", row, col,183 Warn("index (%i,%i) out of bound, max (%i,%i)\n", row, col, 174 184 pimpl_->descriptor->Rows() - 1, pimpl_->descriptor->Cols() - 1); 175 185 } else { 176 pimpl_-> datas[row][col]=value;186 pimpl_->SetValueNoMutex(row, col,value); 177 187 } 178 188 } … … 180 190 void Matrix::CopyDatas(char *dst) const { 181 191 GetMutex(); 182 // printf("%f %x %i\n",cvGetReal2D(pimpl_->mat,0,0),dst,Size());183 192 memcpy(dst, pimpl_->datas, dataType.GetSize()); 184 193 ReleaseMutex();
Note:
See TracChangeset
for help on using the changeset viewer.