Ejemplo n.º 1
0
/**
 * Repackage data in the inverse intensity chromaticity space. The first three
 * channels contain red, green and blue chromaticities. The fourth channel
 * contains 1/(r+g+b).
 * Note that it is necessary to call this method prior to the estimation.
 */
void Tan::createIICSpace(cv::Mat_<cv::Vec3d> &image)
{
//	IIC iic((cv::Mat_<cv::Vec3d>)image, config.min_intensity, config.max_intensity);
	IIC iic((cv::Mat_<cv::Vec3d>)image);
	iic_space = iic.getIIC();
	iic_space_set = true;
}
Ejemplo n.º 2
0
/*
 * ar_initialize()
 * 	ar_initialize() is called by video_register_device() and
 *	initializes AR LSI and peripherals.
 *
 *	-1 is returned in all failures.
 *	0 is returned in success.
 *
 */
static int ar_initialize(struct video_device *dev)
{
	struct ar_device *ar = dev->priv;
	unsigned long cr = 0;
	int i,found=0;

	DEBUG(1, "ar_initialize:\n");

	/*
	 * initialize AR LSI
	 */
	ar_outl(0, ARVCR0);		/* assert reset of AR LSI */
	for (i = 0; i < 0x18; i++)	/* wait for over 10 cycles @ 27MHz */
		cpu_relax();
	ar_outl(ARVCR0_RST, ARVCR0);	/* negate reset of AR LSI (enable) */
	for (i = 0; i < 0x40d; i++)	/* wait for over 420 cycles @ 27MHz */
		cpu_relax();

	/* AR uses INT3 of CPU as interrupt pin. */
	ar_outl(ARINTSEL_INT3, ARINTSEL);

	if (ar->size == AR_SIZE_QVGA)
		cr |= ARVCR1_QVGA;
	if (ar->mode == AR_MODE_NORMAL)
		cr |= ARVCR1_NORMAL;
	ar_outl(cr, ARVCR1);

  	/*
	 * Initialize IIC so that CPU can communicate with AR LSI,
	 * and send boot commands to AR LSI.
	 */
	init_iic();

	for (i = 0; i < 0x100000; i++) {	/* > 0xa1d10,  56ms */
		if ((ar_inl(ARVCR0) & ARVCR0_VDS)) {	/* VSYNC */
			found = 1;
			break;
		}
	}

	if (found == 0)
		return -ENODEV;

	printk("arv: Initializing ");

	iic(2,0x78,0x11,0x01,0x00);	/* start */
	iic(3,0x78,0x12,0x00,0x06);
	iic(3,0x78,0x12,0x12,0x30);
	iic(3,0x78,0x12,0x15,0x58);
	iic(3,0x78,0x12,0x17,0x30);
	printk(".");
	iic(3,0x78,0x12,0x1a,0x97);
	iic(3,0x78,0x12,0x1b,0xff);
	iic(3,0x78,0x12,0x1c,0xff);
	iic(3,0x78,0x12,0x26,0x10);
	iic(3,0x78,0x12,0x27,0x00);
	printk(".");
	iic(2,0x78,0x34,0x02,0x00);
	iic(2,0x78,0x7a,0x10,0x00);
	iic(2,0x78,0x80,0x39,0x00);
	iic(2,0x78,0x81,0xe6,0x00);
	iic(2,0x78,0x8d,0x00,0x00);
	printk(".");
	iic(2,0x78,0x8e,0x0c,0x00);
	iic(2,0x78,0x8f,0x00,0x00);
#if 0
	iic(2,0x78,0x90,0x00,0x00);	/* AWB on=1 off=0 */
#endif
	iic(2,0x78,0x93,0x01,0x00);
	iic(2,0x78,0x94,0xcd,0x00);
	iic(2,0x78,0x95,0x00,0x00);
	printk(".");
	iic(2,0x78,0x96,0xa0,0x00);
	iic(2,0x78,0x97,0x00,0x00);
	iic(2,0x78,0x98,0x60,0x00);
	iic(2,0x78,0x99,0x01,0x00);
	iic(2,0x78,0x9a,0x19,0x00);
	printk(".");
	iic(2,0x78,0x9b,0x02,0x00);
	iic(2,0x78,0x9c,0xe8,0x00);
	iic(2,0x78,0x9d,0x02,0x00);
	iic(2,0x78,0x9e,0x2e,0x00);
	iic(2,0x78,0xb8,0x78,0x00);
	iic(2,0x78,0xba,0x05,0x00);
#if 0
	iic(2,0x78,0x83,0x8c,0x00);	/* brightness */
#endif
	printk(".");

	/* color correction */
	iic(3,0x78,0x49,0x00,0x95);	/* a		*/
	iic(3,0x78,0x49,0x01,0x96);	/* b		*/
	iic(3,0x78,0x49,0x03,0x85);	/* c		*/
	iic(3,0x78,0x49,0x04,0x97);	/* d		*/
	iic(3,0x78,0x49,0x02,0x7e);	/* e(Lo)	*/
	iic(3,0x78,0x49,0x05,0xa4);	/* f(Lo)	*/
	iic(3,0x78,0x49,0x06,0x04);	/* e(Hi)	*/
	iic(3,0x78,0x49,0x07,0x04);	/* e(Hi)	*/
	iic(2,0x78,0x48,0x01,0x00);	/* on=1 off=0	*/

	printk(".");
	iic(2,0x78,0x11,0x00,0x00);	/* end */
	printk(" done\n");
	return 0;
}