• We propose to divide image gradients into image contours and textural gradients according to whether they belong to the groups of connected gradients with larger spatial extents or groups of connected gradients limited in local spaces. • We use image contours to encode illumination discontinuities and use textural gradients to encode variations in reflectance. • We design a cortex-like contour extraction algorithm and a retina-inspired textural gradient detection algorithm, thus a biologically plausible variation model for retinex decomposition. • We reveal and verify the possible mechanism for lightness computation in the biological vision system and the dependency of Land's retinex theory on the perception of image gradients and image contours. Retinex theory was first proposed by Land and McCann [1], where retinex is a portmanteau derived from the words of retina and cortex, implying that both the retina and cerebral cortex may participate in the perception of lightness and color. However, there are no recent reports on how the retina and visual cortex perform retinex decomposition. In this paper, we propose a biologically plausible solution to retinex decomposition. We develop an algorithm motivated by the primate's retinal circuit to detect textural gradients, design an algorithm originating from the visual cortex to extract image contours, and thus split image edges into image contours and textural gradients. Then, we establish a variational model for retinex decomposition by using image contours and textural gradients to encode discontinuities in illumination and variations in reflectance, respectively. We also apply the proposed retinex model to low light image enhancement, high dynamic resolution image toning, and color constancy. Experiments show consistent superiority of the proposed algorithm. The code is available at Github. [ABSTRACT FROM AUTHOR]