static void promcon_putcs(struct vc_data *conp, const unsigned short *s, int count, int y, int x) { unsigned char buf[256], *b = buf; unsigned short attr = scr_readw(s); unsigned char save; int i, last = 0; if (console_blanked) return; if (count <= 0) return; b += promcon_start(conp, b); if (x + count >= pw + 1) { if (count == 1) { x -= 1; save = scr_readw((unsigned short *)(conp->vc_origin + y * conp->vc_size_row + (x << 1))); if (px != x || py != y) { b += sprintf(b, "\033[%d;%dH", y + 1, x + 1); px = x; py = y; } if (inverted(attr)) b += sprintf(b, "\033[7m%c\033[m", scr_readw(s++)); else b += sprintf(b, "%c", scr_readw(s++)); strcpy(b, "\b\033[@"); b += 4; if (inverted(save)) b += sprintf(b, "\033[7m%c\033[m", save); else b += sprintf(b, "%c", save); px++; b += promcon_end(conp, b); promcon_puts(buf, b - buf); return; } else { last = 1; count = pw - x - 1; } } if (inverted(attr)) { strcpy(b, "\033[7m"); b += 4; } if (px != x || py != y) { b += sprintf(b, "\033[%d;%dH", y + 1, x + 1); px = x; py = y; } for (i = 0; i < count; i++) { if (b - buf >= 224) { promcon_puts(buf, b - buf); b = buf; } *b++ = scr_readw(s++); } px += count; if (last) { save = scr_readw(s++); b += sprintf(b, "%c\b\033[@%c", scr_readw(s++), save); px++; } if (inverted(attr)) { strcpy(b, "\033[m"); b += 3; } b += promcon_end(conp, b); promcon_puts(buf, b - buf); }
/////////////////////////////////////////////////////////////////////////////// /// \brief calculate K_start(k*) function: control points /// K_star ((n+3)*n): /// K = [K_star_L , K_star_pixel ; K_star_pixel(t) , 0] /// K -> (inverse) K(-1) /// K(-1) -> get ((n+3)*n) K_star /// \param[in] c_pos position of control points /// \param[in] c_num number of control points /// \param[out] M_tps_value_cp tps basis function between control points and pixel points ////////////////////////////////////////////////////////////////////////////// void K_star_tps(float *c_pos, int c_num, float *K_star) { int K_pos = 0; int K_star_pos = 0; //param for K_star_L int count_ori = 0; int count_tmp = 0; int c_ori_w = 0; int c_ori_h = 0; int c_tmp_w = 0; int c_tmp_h = 0; int i,j = 0; double cc_pos_norm_pow2 = 0; //param for K_star_pixel int assign_count = 0; cv::Mat K = cv::Mat::zeros(c_num + 3,c_num + 3,CV_32FC1); float *K_star_L = new float [c_num * c_num]; float *K_star_pixel = new float [c_num * 3]; //calculate K_star_L for (i = 0; i < c_num * 2;) { c_ori_w = c_pos[i]; c_ori_h = c_pos[i + 1]; for (j = 0; j < c_num * 2;) { K_star_pos = count_ori + count_tmp * c_num; K_pos = count_ori + count_tmp * (c_num + 3); c_tmp_w = c_pos[j]; c_tmp_h = c_pos[j + 1]; if (i == j) { K_star_L[K_star_pos] = 0; K.at<float>(count_ori, count_tmp) = 0; } else { cc_pos_norm_pow2 = pow(abs(c_ori_w - c_tmp_w),2) + pow(abs(c_ori_h - c_tmp_h),2); K_star_L[K_star_pos] = cc_pos_norm_pow2 * log(cc_pos_norm_pow2); K.at<float>(count_ori, count_tmp) = K_star_L[K_star_pos]; } //create K_star_pixel and its transpose if (assign_count < c_num) { K_star_pixel[count_tmp] = 1; K_star_pixel[count_tmp + c_num] = c_tmp_w; K_star_pixel[count_tmp + c_num * 2] = c_tmp_h; //assign K_star_pixel and its transpose to K //assign K_star_pixel K.at<float>(c_num, count_tmp) = 1; K.at<float>(c_num + 1, count_tmp) = c_tmp_w; K.at<float>(c_num + 2, count_tmp) = c_tmp_h; //assign tramspose K.at<float>(count_tmp, c_num) = 1; K.at<float>(count_tmp, c_num + 1) = c_tmp_w; K.at<float>(count_tmp, c_num + 2) = c_tmp_h; assign_count++; } count_tmp++; j = j + 2; } count_tmp = 0; count_ori++; i = i + 2; } //printf("start fill 0 \n"); ////fiil the rest of K with 0 //for (i = 0; i < 3; i++) //{ //K[c_num + (c_num + i) * (c_num + 3)] = 0; //K[(c_num + 1) + (c_num + i) * (c_num + 3)] = 0; //K[(c_num + 2) + (c_num + i) * (c_num + 3)] = 0; //} printf("start fill result \n"); //fill results to K_star for (i = 0; i < (c_num + 3); i++) { for (j = 0; j < c_num; j++) { K_star_pos = i + j * (c_num + 3); K_star[K_star_pos] = K.at<float>(j,i); } } //printf("start show K \n"); //for (i = 0; i < (c_num + 3); i++) //{ //for (j = 0; j < (c_num + 3); j++) //{ //printf("%f \t",K[i + j * (c_num + 3)]); //if (j == (c_num + 2)) //{ //printf("\n"); //} //} //} ////test cv invert //cv::Mat A(c_num + 3,c_num + 3,CV_32FC1); //for (unsigned int i = 0; i < c_num + 3; i++) //{ //for (unsigned int j = 0; j < c_num + 3; j++) //{ //A.at<float>(i,j) = K[i + j * (c_num + 3)]; //} //} cv::Mat inverted(c_num + 3,c_num + 3,CV_32FC1); invert(K, inverted, cv::DECOMP_SVD); std::cout << "k: "<< K << std::endl; std::cout << "inverted: " << inverted << std::endl; printf("finish show K \n"); delete [] K_star_L; delete [] K_star_pixel; }
int QRangeModel::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: valueChanged((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 1: positionChanged((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 2: stepSizeChanged((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 3: invertedChanged((*reinterpret_cast< bool(*)>(_a[1]))); break; case 4: minimumChanged((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 5: maximumChanged((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 6: positionAtMinimumChanged((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 7: positionAtMaximumChanged((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 8: toMinimum(); break; case 9: toMaximum(); break; case 10: setValue((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 11: setPosition((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 12: { qreal _r = valueForPosition((*reinterpret_cast< qreal(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< qreal*>(_a[0]) = _r; } break; case 13: { qreal _r = positionForValue((*reinterpret_cast< qreal(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< qreal*>(_a[0]) = _r; } break; default: ; } _id -= 14; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< qreal*>(_v) = value(); break; case 1: *reinterpret_cast< qreal*>(_v) = minimum(); break; case 2: *reinterpret_cast< qreal*>(_v) = maximum(); break; case 3: *reinterpret_cast< qreal*>(_v) = stepSize(); break; case 4: *reinterpret_cast< qreal*>(_v) = position(); break; case 5: *reinterpret_cast< qreal*>(_v) = positionAtMinimum(); break; case 6: *reinterpret_cast< qreal*>(_v) = positionAtMaximum(); break; case 7: *reinterpret_cast< bool*>(_v) = inverted(); break; } _id -= 8; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setValue(*reinterpret_cast< qreal*>(_v)); break; case 1: setMinimum(*reinterpret_cast< qreal*>(_v)); break; case 2: setMaximum(*reinterpret_cast< qreal*>(_v)); break; case 3: setStepSize(*reinterpret_cast< qreal*>(_v)); break; case 4: setPosition(*reinterpret_cast< qreal*>(_v)); break; case 5: setPositionAtMinimum(*reinterpret_cast< qreal*>(_v)); break; case 6: setPositionAtMaximum(*reinterpret_cast< qreal*>(_v)); break; case 7: setInverted(*reinterpret_cast< bool*>(_v)); break; } _id -= 8; } else if (_c == QMetaObject::ResetProperty) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 8; } #endif // QT_NO_PROPERTIES return _id; }
jarl::Matrix jarl::Matrix::inverse() const { jarl::Matrix inverted(lr, -ll, -ur, ul); inverted /= determinate(); return inverted; }