! * \brief pixScaleByIntSampling() * * \param[in] pixs 1, 2, 4, 8, 16, 32 bpp * \param[in] factor integer subsampling * \return pixd, or NULL on error * * * Notes: * (1) Simple interface to pixScaleBySampling(), for * isotropic integer reduction. * (2) If %factor == 1, returns a copy. * */
| 1402 | * </pre> |
| 1403 | */ |
| 1404 | PIX * |
| 1405 | pixScaleByIntSampling(PIX *pixs, |
| 1406 | l_int32 factor) |
| 1407 | { |
| 1408 | l_float32 scale; |
| 1409 | |
| 1410 | PROCNAME("pixScaleByIntSampling"); |
| 1411 | |
| 1412 | if (!pixs) |
| 1413 | return (PIX *)ERROR_PTR("pixs not defined", procName, NULL); |
| 1414 | if (factor <= 1) { |
| 1415 | if (factor < 1) |
| 1416 | L_ERROR("factor must be >= 1; returning a copy\n", procName); |
| 1417 | return pixCopy(NULL, pixs); |
| 1418 | } |
| 1419 | |
| 1420 | scale = 1. / (l_float32)factor; |
| 1421 | return pixScaleBySampling(pixs, scale, scale); |
| 1422 | } |
| 1423 | |
| 1424 | |
| 1425 | /*------------------------------------------------------------------* |
no test coverage detected