Many content‐based image retrieval techniques like local binary pattern (LBP), local ternary pattern (LTP), local mesh peak valley edge pattern (LMePVEP), local mesh ternary pattern (LMeTerP), etc. extract texture features of an image for retrieval purposes. These techniques use fixed threshold to encode the input image and selection of such threshold value is not guided, that is, a chosen threshold may not be optimal for all images in the database. Moreover the performance of these texture‐based static threshold algorithms also decreases if the input images are noisy. In this paper, a dynamic threshold value‐based local mesh ternary pattern method is proposed in which the threshold value is chosen from the neighborhood of a central pixel using median of all pixels. The proposed modification reduces the overall effect of noise component and thereby improves the average retrieval rate (ARR) and average retrieval precision (ARP) of the original technique. The proposed modified technique has been compared with five other image retrieval approaches to prove its worthiness ‐ the original local mesh ternary pattern technique (LMeTerP), a local ternary pattern technique (LTP), a Best ensemble technique, a multi‐label classification CNN model and a CNN‐based model of the proposed approach using a VIA ELCAP lung database and an Emphysema database. An improvement of 3.92% in ARR and 2.53% in ARP is observed over the basic local mesh ternary pattern method. Further the proposed modification has been combined with CNN concept and its results have also been analyzed.