MASK LLKeyboardWin32::updateModifiers()
{
	//RN: this seems redundant, as we should have already received the appropriate
	// messages for the modifier keys

	// Scan the modifier keys as of the last Windows key message
	// (keydown encoded in high order bit of short)
	mKeyLevel[KEY_CAPSLOCK] = (GetKeyState(VK_CAPITAL) & 0x0001) != 0; // Low order bit carries the toggle state.
	// Get mask for keyboard events
	MASK mask = currentMask(FALSE);
	return mask;
}
Ejemplo n.º 2
0
void place::displayScanAndMask(
    const std::vector<std::vector<Eigen::SparseMatrix<double>>>
        &rSSparsePyramidTrimmed,
    const std::vector<std::vector<Eigen::MatrixXb>> &eMaskPyramidTrimmedNS) {

  for (int i = 0; i < rSSparsePyramidTrimmed.size(); ++i) {
    for (int j = 0; j < rSSparsePyramidTrimmed[i].size(); ++j) {
      const Eigen::SparseMatrix<double> &currentScan =
          rSSparsePyramidTrimmed[i][j];
      const Eigen::MatrixXb &currentMask = eMaskPyramidTrimmedNS[i][j];
      cv::Mat out(currentScan.rows(), currentScan.cols(), CV_8UC3,
                  cv::Scalar::all(255));

      for (int i = 0; i < out.rows; ++i) {
        uchar *dst = out.ptr<uchar>(i);
        for (int j = 0; j < out.cols; ++j) {
          if (currentMask(i, j) != 0) {
            dst[3 * j] = 0;
            dst[3 * j + 1] = 0;
            dst[3 * j + 2] = 0;
          }
        }
      }

      cv::Mat_<cv::Vec3b> _out = out;
      for (int i = 0; i < currentScan.outerSize(); ++i) {
        for (Eigen::SparseMatrix<double>::InnerIterator it(currentScan, i); it;
             ++it) {
          if (it.value() > 0 && _out(it.row(), it.col())[0] == 0) {
            _out(it.row(), it.col())[0] = 0;
            _out(it.row(), it.col())[1] = 255;
            _out(it.row(), it.col())[2] = 0;
          } else if (it.value() > 0) {
            _out(it.row(), it.col())[0] = 0;
            _out(it.row(), it.col())[1] = 0;
            _out(it.row(), it.col())[2] = 255;
          }
        }
      }
      out = _out;
      cv::rectshow(out);
    }
  }
}